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, truncate
public 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)
RawIOBase
public int write(ByteBuffer buf)
RawIOBase
public void flush()
IOBase
public void close()
IOBase
public boolean isatty()
IOBase
public boolean readable()
IOBase
public boolean writable()
IOBase
public OutputStream asOutputStream()
IOBase
asOutputStream
in class IOBase
public InputStream asInputStream()
IOBase
asInputStream
in class IOBase
public Channel getChannel()
RawIOBase
getChannel
in class RawIOBase