@Module public class JniStream extends StreamImpl
| Modifier and Type | Field and Description |
|---|---|
static int |
TIMEOUT_EXN |
_nullPath, _path| Constructor and Description |
|---|
JniStream(JniSocketImpl socket)
Create a new JniStream based on the java.io.* stream.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canRead()
Returns true if this is a read stream.
|
boolean |
canWrite()
Returns true if this is a writable stream.
|
void |
close()
Closes the stream.
|
void |
flush()
Flushes the write output.
|
int |
getAvailable()
Returns the number of bytes available without blocking.
|
long |
getTotalReadBytes() |
long |
getTotalWriteBytes() |
void |
init() |
boolean |
isClosed()
Returns true if the stream is closed.
|
boolean |
isEof() |
boolean |
isMmapEnabled()
Returns true if the stream supports mmap.
|
boolean |
isSendfileEnabled()
Returns true if the stream supports mmap.
|
int |
read(byte[] buf,
int offset,
int length)
Reads the next chunk from the stream.
|
int |
readTimeout(byte[] buf,
int offset,
int length,
long timeout)
Reads the next chunk from the stream in non-blocking mode.
|
java.lang.String |
toString() |
void |
write(byte[] buf,
int offset,
int length,
boolean isEnd)
Writes a buffer to the underlying stream.
|
void |
writeMmap(long mmapAddress,
long[] mmapBlocks,
long mmapOffset,
long mmapLength) |
void |
writeSendfile(byte[] buffer,
int offset,
int length,
byte[] fileName,
int nameLength,
long fileLength) |
clearWrite, closeWrite, flushBuffer, flushToDisk, getAttribute, getAttributeNames, getFlushOnNewline, getNewline, getPath, getReadBuffer, getReadPosition, hasSkip, readNonBlock, removeAttribute, seekEnd, seekStart, setAttribute, setPath, setWriteEncoding, skip, writepublic static final int TIMEOUT_EXN
public JniStream(JniSocketImpl socket)
public void init()
public boolean canRead()
StreamImplcanRead in class StreamImplpublic boolean isClosed()
StreamImplisClosed in class StreamImplpublic int read(byte[] buf,
int offset,
int length)
throws java.io.IOException
StreamImplread in class StreamImplbuf - byte array receiving the data.offset - starting offset into the array.length - number of bytes to read.java.io.IOExceptionpublic int readTimeout(byte[] buf,
int offset,
int length,
long timeout)
throws java.io.IOException
StreamImplreadTimeout in class StreamImplbuf - byte array receiving the data.offset - starting offset into the array.length - number of bytes to read.java.io.IOExceptionpublic int getAvailable()
throws java.io.IOException
StreamImplgetAvailable in class StreamImpljava.io.IOExceptionpublic boolean isEof()
throws java.io.IOException
isEof in class StreamImpljava.io.IOExceptionpublic boolean canWrite()
StreamImplcanWrite in class StreamImplpublic void write(byte[] buf,
int offset,
int length,
boolean isEnd)
throws java.io.IOException
StreamImplwrite in class StreamImplbuf - the byte array to write.offset - the offset into the byte array.length - the number of bytes to write.isEnd - true when the write is flushing a close.java.io.IOExceptionpublic boolean isMmapEnabled()
StreamImplisMmapEnabled in class StreamImplpublic void writeMmap(long mmapAddress,
long[] mmapBlocks,
long mmapOffset,
long mmapLength)
throws java.io.IOException
writeMmap in class StreamImpljava.io.IOExceptionpublic boolean isSendfileEnabled()
StreamImplisSendfileEnabled in class StreamImplpublic void writeSendfile(byte[] buffer,
int offset,
int length,
byte[] fileName,
int nameLength,
long fileLength)
throws java.io.IOException
writeSendfile in class StreamImpljava.io.IOExceptionpublic void flush()
throws java.io.IOException
StreamImplflush in class StreamImpljava.io.IOExceptionpublic long getTotalReadBytes()
public long getTotalWriteBytes()
public void close()
throws java.io.IOException
close in class StreamImpljava.io.IOExceptionpublic java.lang.String toString()
toString in class java.lang.Object