public class StreamIO extends RawIOBase
DEFAULT_BUFFER_SIZE| Constructor and Description |
|---|
StreamIO(InputStream inputStream,
boolean closefd)
Construct a StreamIO for the given read/write streams.
|
StreamIO(OutputStream outputStream,
boolean closefd)
Construct a StreamIO for the given read/write streams.
|
StreamIO(ReadableByteChannel readChannel)
Construct a StreamIO for the given read channel.
|
StreamIO(ReadableByteChannel readChannel,
boolean closefd)
Construct a StreamIO for the given read channel.
|
StreamIO(WritableByteChannel writeChannel)
Construct a StreamIO for the given write channel.
|
StreamIO(WritableByteChannel writeChannel,
boolean closefd)
Construct a StreamIO for the given write channel.
|
| Modifier and Type | Method and Description |
|---|---|
InputStream |
asInputStream()
Coerce this into an InputStream if possible, or return null.
|
OutputStream |
asOutputStream()
Coerce this into an OutputStream if possible, or return null.
|
void |
close()
Flushes and closes the IO object.
|
void |
flush()
Flushes write buffers, if applicable.
|
Channel |
getChannel()
Return the underlying Java nio Channel.
|
boolean |
isatty()
Returns whether this is an 'interactive' stream.
|
boolean |
readable()
Return whether this file was opened for reading.
|
int |
readinto(ByteBuffer buf)
Read up to buf.remaining() bytes into buf.
|
boolean |
writable()
Return whether this file was opened for writing.
|
int |
write(ByteBuffer buf)
Write the given ByteBuffer to the IO stream.
|
checkClosed, checkReadable, checkWritable, closed, seek, seek, tell, truncatepublic StreamIO(ReadableByteChannel readChannel, boolean closefd)
readChannel - a ReadableByteChannelclosefd - boolean whether the underlying file is closed on
close() (defaults to True)public StreamIO(ReadableByteChannel readChannel)
readChannel - a ReadableByteChannelpublic StreamIO(WritableByteChannel writeChannel, boolean closefd)
writeChannel - a WritableByteChannelclosefd - boolean whether the underlying file is closed on
close() (defaults to True)public StreamIO(WritableByteChannel writeChannel)
writeChannel - a WritableByteChannelpublic StreamIO(InputStream inputStream, boolean closefd)
inputStream - an InputStreamclosefd - boolean whether the underlying file is closed on
close() (defaults to True)public StreamIO(OutputStream outputStream, boolean closefd)
outputStream - an OutputStreamclosefd - boolean whether the underlying file is closed on
close() (defaults to True)public int readinto(ByteBuffer buf)
RawIOBasepublic int write(ByteBuffer buf)
RawIOBasepublic void flush()
IOBasepublic void close()
IOBasepublic boolean isatty()
IOBasepublic boolean readable()
IOBasepublic boolean writable()
IOBasepublic OutputStream asOutputStream()
IOBaseasOutputStream in class IOBasepublic InputStream asInputStream()
IOBaseasInputStream in class IOBasepublic Channel getChannel()
RawIOBasegetChannel in class RawIOBase