public final class ContentReaders
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static Reader<byte[]> |
byteArrayReader()
The returned reader provides means to convert a
ByteBuffer publisher to
an array of bytes. |
static Reader<java.io.InputStream> |
inputStreamReader()
Creates a reader that bridges Flow API IO to a blocking Java
InputStream. |
static StringContentReader |
stringReader(java.nio.charset.Charset charset)
For basic charsets, returns a cached
StringContentReader instance
or create a new instance otherwise. |
public static StringContentReader stringReader(java.nio.charset.Charset charset)
StringContentReader instance
or create a new instance otherwise.charset - the charset to use with the returned string content readerpublic static Reader<byte[]> byteArrayReader()
ByteBuffer publisher to
an array of bytes.
Returns a lazily initialized classloader-scoped singleton.
Note that the singleton aspect is not guarantied by all JVMs. Although, Oracle JVM does create a singleton because the lambda does not capture values.
IllegalArgumentException if it wasn't possible to convert the byte buffer
to an array of bytespublic static Reader<java.io.InputStream> inputStreamReader()
InputStream.
The resulting CompletionStage is already completed;
however, the referenced InputStream in it may not already have all the data
available; in such case, the read method (e.g., InputStream.read()) block.Copyright © 2018, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.