|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.python.core.io.IOBase
org.python.core.io.RawIOBase
org.python.core.io.StreamIO
public class StreamIO
Raw I/O implementation for simple streams. Supports Input/Outputstreams and Readable/WritableByteChannels.
| Field Summary |
|---|
| Fields inherited from class org.python.core.io.IOBase |
|---|
DEFAULT_BUFFER_SIZE |
| Constructor Summary | |
|---|---|
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. |
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class org.python.core.io.RawIOBase |
|---|
fileno, read, readall, readinto, write |
| Methods inherited from class org.python.core.io.IOBase |
|---|
checkClosed, checkReadable, checkWritable, closed, seek, seek, tell, truncate |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
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 ReadableByteChannel
public 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 WritableByteChannel
public 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)| Method Detail |
|---|
public int readinto(ByteBuffer buf)
RawIOBase
readinto in class RawIOBasebuf - a ByteBuffer to read bytes into
public int write(ByteBuffer buf)
RawIOBase
write in class RawIOBasebuf - a ByteBuffer value
public void flush()
IOBase
flush in class IOBasepublic void close()
IOBase
close in class IOBasepublic boolean isatty()
IOBase
isatty in class IOBasepublic boolean readable()
IOBase
readable in class IOBasepublic boolean writable()
IOBase
writable in class IOBasepublic OutputStream asOutputStream()
IOBase
asOutputStream in class IOBasepublic InputStream asInputStream()
IOBase
asInputStream in class IOBasepublic Channel getChannel()
RawIOBase
getChannel in class RawIOBase
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||