public interface IOStreams
Modifier and Type | Method and Description |
---|---|
byte[] |
asByteArray(InputStream is)
buffer the contents of the specified byte stream into a byte[] array.
|
InputStream |
asInputStream(byte[] bytes)
Adapt the specified byte array to an instance of
InputStream . |
InputStream |
asInputStream(CharSequence text)
Convert a
CharSequence into an InputStream instance |
String |
asString(InputStream is)
Buffer the contents of the specified byte stream into a
String . |
String |
asString(Readable r)
Buffer the contents of the specified character stream into a
String
. |
long |
copy(InputStream is,
OutputStream os)
Copy the contents of a
InputStream to an OutputStream |
long |
copy(Readable source,
Appendable destination)
Copy the contents of a
Readable (input character stream) to an
Appendable (output character stream) |
long |
copy(ReadableByteChannel source,
WritableByteChannel destination)
Copy the contents of a
ReadableByteChannel (input byte stream) to a
WritableByteChannel (output byte stream) |
InputStream |
emptyStream()
Return an InputStream containing zero bytes
|
boolean |
isEmptyStream(InputStream stream)
Checks if the specified
InputStream is the empty stream instance
provided by emptyStream() . |
InputStream |
uncloseable(InputStream in)
Wrapper an InputStream so it cannot be closed.
|
long copy(InputStream is, OutputStream os) throws IOException
InputStream
to an OutputStream
is
- The stream containing the contentos
- The stream to write the content toIOException
long copy(Readable source, Appendable destination) throws IOException
Readable
(input character stream) to an
Appendable
(output character stream)source
- The stream containing the contentdestination
- The stream to write the content toIOException
long copy(ReadableByteChannel source, WritableByteChannel destination) throws IOException
ReadableByteChannel
(input byte stream) to a
WritableByteChannel
(output byte stream)source
- The stream containing the contentdestination
- The stream to write the content toIOException
InputStream emptyStream()
InputStream uncloseable(InputStream in)
in
- InputStream instanceboolean isEmptyStream(InputStream stream)
InputStream
is the empty stream instance
provided by emptyStream()
.stream
- The stream to be testedInputStream
is the same instance,
false otherwise.String asString(InputStream is) throws IOException
String
. The
contents of the byte stream must be encoded in UTF-8
.is
- The byte streamString
IOException
String asString(Readable r) throws IOException
String
.r
- The character streamString
IOException
InputStream asInputStream(CharSequence text) throws IOException
CharSequence
into an InputStream
instancetext
- The text to be transformed into an InputStream
InputStream
instanceIOException
InputStream asInputStream(byte[] bytes)
InputStream
.bytes
- The bytes to be exposed as a streamInputStream
instance.byte[] asByteArray(InputStream is) throws IOException
is
- The byte streamIOException
Oracle REST Data Services Plugin API version: 3.0.0.65.09.35 Copyright © 2015 Oracle Corp. All Rights Reserved.