public class FileReadStream extends StreamImpl implements LockableStream
_nullPath, _path
Constructor and Description |
---|
FileReadStream()
Create a new FileReadStream.
|
FileReadStream(java.io.FileInputStream is)
Create a new FileReadStream based on the java.io.* stream.
|
FileReadStream(java.io.FileInputStream is,
Path path)
Create a new FileReadStream based on the java.io.* stream.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canRead()
Returns true if there's an associated file.
|
void |
close()
Closes the underlying stream.
|
int |
getAvailable()
Returns the number of bytes available for reading.
|
boolean |
hasSkip()
Returns true if there's an associated file.
|
void |
init(java.io.FileInputStream is)
Initializes a VfsStream with an input/output stream pair.
|
boolean |
lock(boolean shared,
boolean block)
Lock the shared advisory lock.
|
int |
read(byte[] buf,
int offset,
int length)
Reads bytes from the file.
|
void |
seekStart(long offset)
Seeks based on the start.
|
long |
skip(long n)
Skips bytes in the file.
|
boolean |
unlock()
Unlock the advisory lock.
|
canWrite, clearWrite, closeWrite, flush, flushBuffer, flushToDisk, getAttribute, getAttributeNames, getFlushOnNewline, getNewline, getPath, getReadBuffer, getReadPosition, isClosed, isEof, isMmapEnabled, isSendfileEnabled, readNonBlock, readTimeout, removeAttribute, seekEnd, setAttribute, setPath, setWriteEncoding, write, write, writeMmap, writeSendfile
public FileReadStream()
public FileReadStream(java.io.FileInputStream is)
is
- the underlying input stream.public FileReadStream(java.io.FileInputStream is, Path path)
is
- the underlying input stream.path
- the associated Path.public void init(java.io.FileInputStream is)
is
- the underlying InputStream.os
- the underlying OutputStream.public boolean hasSkip()
hasSkip
in class StreamImpl
public long skip(long n) throws java.io.IOException
skip
in class StreamImpl
n
- the number of bytes to skipjava.io.IOException
public void seekStart(long offset) throws java.io.IOException
seekStart
in class StreamImpl
java.io.IOException
public boolean canRead()
canRead
in class StreamImpl
public int read(byte[] buf, int offset, int length) throws java.io.IOException
read
in class StreamImpl
buf
- a byte array receiving the data.offset
- starting index to receive data.length
- number of bytes to read.java.io.IOException
public int getAvailable() throws java.io.IOException
getAvailable
in class StreamImpl
java.io.IOException
public void close() throws java.io.IOException
close
in class StreamImpl
java.io.IOException
public boolean lock(boolean shared, boolean block)
LockableStream
lock
in interface LockableStream
public boolean unlock()
LockableStream
unlock
in interface LockableStream