public class VfsStream extends StreamImpl
_nullPath, _path| Constructor and Description |
|---|
VfsStream()
Create an empty VfsStream.
|
VfsStream(java.io.InputStream is,
java.io.OutputStream os)
Create a new VfsStream based on the java.io.* stream.
|
VfsStream(java.io.InputStream is,
java.io.OutputStream os,
Path path) |
| 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.
|
void |
flushToDisk()
Flushes the write output, forcing to disk.
|
int |
getAvailable()
Returns the number of bytes available without blocking.
|
boolean |
getFlushOnNewline()
Returns true if the buffer should be flushed on every newline.
|
byte[] |
getNewline()
Returns the stream's natural newline character.
|
long |
getReadPosition()
Returns the current read position of the underlying file.
|
boolean |
hasSkip()
Returns true if the stream implements skip.
|
void |
init(java.io.InputStream is,
java.io.OutputStream os)
Initializes a VfsStream with an input/output stream pair.
|
static ReadStream |
openRead(java.io.InputStream is)
Opens a read stream based on a java.io.InputStream.
|
static ReadStream |
openRead(java.io.InputStream is,
WriteStream ws) |
static ReadWritePair |
openReadWrite(java.io.InputStream is,
java.io.OutputStream os) |
static WriteStream |
openWrite(java.io.OutputStream os) |
int |
read(byte[] buf,
int offset,
int length)
Reads the next chunk from the stream.
|
void |
setCloseChildOnClose(boolean close) |
void |
setFlushOnNewline(boolean value) |
void |
setNewline(byte[] newline) |
long |
skip(long n)
Skips a number of bytes, returning the bytes skipped.
|
java.lang.String |
toString() |
void |
write(byte[] buf,
int offset,
int length,
boolean isEnd)
Writes a buffer to the underlying stream.
|
clearWrite, closeWrite, flushBuffer, getAttribute, getAttributeNames, getPath, getReadBuffer, isClosed, isEof, isMmapEnabled, isSendfileEnabled, readNonBlock, readTimeout, removeAttribute, seekEnd, seekStart, setAttribute, setPath, setWriteEncoding, write, writeMmap, writeSendfilepublic VfsStream()
public VfsStream(java.io.InputStream is,
java.io.OutputStream os)
public VfsStream(java.io.InputStream is,
java.io.OutputStream os,
Path path)
public void init(java.io.InputStream is,
java.io.OutputStream os)
is - the underlying InputStream.os - the underlying OutputStream.public void setNewline(byte[] newline)
public byte[] getNewline()
StreamImplgetNewline in class StreamImplpublic static ReadWritePair openReadWrite(java.io.InputStream is, java.io.OutputStream os)
public static ReadStream openRead(java.io.InputStream is)
is - the underlying InputStream.public static ReadStream openRead(java.io.InputStream is, WriteStream ws)
public static WriteStream openWrite(java.io.OutputStream os)
public boolean canRead()
StreamImplcanRead 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 boolean hasSkip()
StreamImplhasSkip in class StreamImplpublic long skip(long n)
throws java.io.IOException
StreamImplskip in class StreamImpln - the number of types to skip.java.io.IOExceptionpublic int getAvailable()
throws java.io.IOException
StreamImplgetAvailable in class StreamImpljava.io.IOExceptionpublic long getReadPosition()
StreamImplgetReadPosition in class StreamImplpublic boolean canWrite()
StreamImplcanWrite in class StreamImplpublic boolean getFlushOnNewline()
StreamImplgetFlushOnNewline in class StreamImplpublic void setFlushOnNewline(boolean value)
public void write(byte[] buf,
int offset,
int length,
boolean isEnd)
throws java.io.IOException
write in class StreamImplbuffer - 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 flushToDisk()
throws java.io.IOException
StreamImplflushToDisk in class StreamImpljava.io.IOExceptionpublic void flush()
throws java.io.IOException
StreamImplflush in class StreamImpljava.io.IOExceptionpublic void setCloseChildOnClose(boolean close)
public void close()
throws java.io.IOException
StreamImplclose in class StreamImpljava.io.IOExceptionpublic java.lang.String toString()
toString in class java.lang.Object