@PublicApi public final class FileInStream extends InputStream implements BoundedStream, Seekable
read()
methods to access this stream of bytes. In addition, one can seek
into a given offset of the stream to read.
This class wraps the BlockInStream
for each of the blocks in the
file and abstracts the switching between streams. The backing streams can read from Tachyon space
in the local machine, remote machines, or the under storage system.
Constructor and Description |
---|
FileInStream(FileInfo info,
InStreamOptions options)
Creates a new file input stream.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
int |
read() |
int |
read(byte[] b) |
int |
read(byte[] b,
int off,
int len) |
long |
remaining()
Gets the remaining number of bytes left in the stream, starting at the current position.
|
void |
seek(long pos)
Moves the starting read position of the stream to the specified position which is relative to
the start of the stream.
|
long |
skip(long n) |
available, mark, markSupported, reset
public FileInStream(FileInfo info, InStreamOptions options)
info
- the file informationoptions
- the client optionspublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class InputStream
IOException
public int read() throws IOException
read
in class InputStream
IOException
public int read(byte[] b) throws IOException
read
in class InputStream
IOException
public int read(byte[] b, int off, int len) throws IOException
read
in class InputStream
IOException
public long remaining()
BoundedStream
remaining
in interface BoundedStream
public void seek(long pos) throws IOException
Seekable
seek
in interface Seekable
pos
- The position to seek to, it must be between 0 and the end of the stream - 1.IOException
- if the seek fails due to an error accessing the stream at the positionpublic long skip(long n) throws IOException
skip
in class InputStream
IOException
Copyright © 2015. All Rights Reserved.