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, writeSendfile
public 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()
StreamImpl
getNewline
in class StreamImpl
public 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()
StreamImpl
canRead
in class StreamImpl
public int read(byte[] buf, int offset, int length) throws java.io.IOException
StreamImpl
read
in class StreamImpl
buf
- byte array receiving the data.offset
- starting offset into the array.length
- number of bytes to read.java.io.IOException
public boolean hasSkip()
StreamImpl
hasSkip
in class StreamImpl
public long skip(long n) throws java.io.IOException
StreamImpl
skip
in class StreamImpl
n
- the number of types to skip.java.io.IOException
public int getAvailable() throws java.io.IOException
StreamImpl
getAvailable
in class StreamImpl
java.io.IOException
public long getReadPosition()
StreamImpl
getReadPosition
in class StreamImpl
public boolean canWrite()
StreamImpl
canWrite
in class StreamImpl
public boolean getFlushOnNewline()
StreamImpl
getFlushOnNewline
in class StreamImpl
public void setFlushOnNewline(boolean value)
public void write(byte[] buf, int offset, int length, boolean isEnd) throws java.io.IOException
write
in class StreamImpl
buffer
- 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.IOException
public void flushToDisk() throws java.io.IOException
StreamImpl
flushToDisk
in class StreamImpl
java.io.IOException
public void flush() throws java.io.IOException
StreamImpl
flush
in class StreamImpl
java.io.IOException
public void setCloseChildOnClose(boolean close)
public void close() throws java.io.IOException
StreamImpl
close
in class StreamImpl
java.io.IOException
public java.lang.String toString()
toString
in class java.lang.Object