public class JniFileStream extends StreamImpl implements LockableStream
_nullPath, _path| Constructor and Description |
|---|
JniFileStream(int fd,
boolean canRead,
boolean canWrite)
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 writeable stream.
|
void |
close()
Closes the stream.
|
protected void |
finalize() |
void |
flush()
Flushes the write output.
|
void |
flushToDisk()
Flushes the write output, forcing to disk.
|
int |
getAvailable()
Returns the number of bytes available without blocking.
|
static java.lang.Throwable |
getDisableCause() |
boolean |
hasSkip()
Returns true if the stream implements skip.
|
static boolean |
isEnabled() |
boolean |
lock(boolean shared,
boolean block)
Implement LockableStream as a no-op, but maintain
compatibility with FileWriteStream and FileReadStream
wrt returning false to indicate error case.
|
static JniFileStream |
openRead(byte[] name,
int length) |
static JniFileStream |
openWrite(byte[] name,
int length,
boolean isAppend) |
int |
read(byte[] buf,
int offset,
int length)
Reads data from the file.
|
void |
seekEnd(long offset)
Seeks based on the end.
|
void |
seekStart(long offset)
Seeks based on the start.
|
long |
skip(long length)
Skips a number of bytes, returning the bytes skipped.
|
java.lang.String |
toString()
Returns the debug name for the stream.
|
boolean |
unlock()
Unlock the advisory lock.
|
void |
write(byte[] buf,
int offset,
int length,
boolean isEnd)
Writes data to the file.
|
clearWrite, closeWrite, flushBuffer, getAttribute, getAttributeNames, getFlushOnNewline, getNewline, getPath, getReadBuffer, getReadPosition, isClosed, isEof, isMmapEnabled, isSendfileEnabled, readNonBlock, readTimeout, removeAttribute, setAttribute, setPath, setWriteEncoding, write, writeMmap, writeSendfilepublic JniFileStream(int fd,
boolean canRead,
boolean canWrite)
public static boolean isEnabled()
public static java.lang.Throwable getDisableCause()
public static JniFileStream openRead(byte[] name, int length)
public static JniFileStream openWrite(byte[] name, int length, boolean isAppend)
public boolean canRead()
StreamImplcanRead in class StreamImplpublic boolean hasSkip()
StreamImplhasSkip in class StreamImplpublic long skip(long length)
throws java.io.IOException
StreamImplskip in class StreamImpllength - the number of types to skip.java.io.IOExceptionpublic int read(byte[] buf,
int offset,
int length)
throws java.io.IOException
read 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 canWrite()
canWrite in class StreamImplpublic void write(byte[] buf,
int offset,
int length,
boolean isEnd)
throws java.io.IOException
write 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 void seekStart(long offset)
throws java.io.IOException
StreamImplseekStart in class StreamImpljava.io.IOExceptionpublic void seekEnd(long offset)
throws java.io.IOException
StreamImplseekEnd in class StreamImpljava.io.IOExceptionpublic void flush()
throws java.io.IOException
StreamImplflush in class StreamImpljava.io.IOExceptionpublic void flushToDisk()
throws java.io.IOException
StreamImplflushToDisk in class StreamImpljava.io.IOExceptionpublic void close()
throws java.io.IOException
StreamImplclose in class StreamImpljava.io.IOExceptionprotected void finalize()
throws java.io.IOException
finalize in class java.lang.Objectjava.io.IOExceptionpublic boolean lock(boolean shared,
boolean block)
lock in interface LockableStreampublic boolean unlock()
LockableStreamunlock in interface LockableStreampublic java.lang.String toString()
toString in class java.lang.Object