@InterfaceAudience.Public @InterfaceStability.Stable public class FSDataInputStream extends DataInputStream implements Seekable, PositionedReadable, Closeable
FSInputStream in a DataInputStream
and buffers input through a BufferedInputStream.in| Constructor and Description |
|---|
FSDataInputStream(InputStream in) |
| Modifier and Type | Method and Description |
|---|---|
long |
getPos()
Get the current position in the input stream.
|
int |
read(long position,
byte[] buffer,
int offset,
int length)
Read bytes from the given position in the stream to the given buffer.
|
void |
readFully(long position,
byte[] buffer)
|
void |
readFully(long position,
byte[] buffer,
int offset,
int length)
Read bytes from the given position in the stream to the given buffer.
|
void |
seek(long desired)
Seek to the given offset.
|
boolean |
seekToNewSource(long targetPos)
Seek to the given position on an alternate copy of the data.
|
read, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, readUTF, skipBytesavailable, close, mark, markSupported, read, reset, skippublic FSDataInputStream(InputStream in) throws IOException
IOExceptionpublic void seek(long desired) throws IOException
seek in interface Seekabledesired - offset to seek toIOExceptionpublic long getPos() throws IOException
getPos in interface SeekableIOExceptionpublic int read(long position, byte[] buffer, int offset, int length) throws IOException
read in interface PositionedReadableposition - position in the input stream to seekbuffer - buffer into which data is readoffset - offset into the buffer in which data is writtenlength - maximum number of bytes to read-1
if there is no more data because the end of the stream has been
reachedIOExceptionpublic void readFully(long position, byte[] buffer, int offset, int length) throws IOException
length bytes have been read.readFully in interface PositionedReadableposition - position in the input stream to seekbuffer - buffer into which data is readoffset - offset into the buffer in which data is writtenlength - the number of bytes to readEOFException - If the end of stream is reached while reading.
If an exception is thrown an undetermined number
of bytes in the buffer may have been written.IOExceptionpublic void readFully(long position, byte[] buffer) throws IOException
readFully in interface PositionedReadableIOExceptionpublic boolean seekToNewSource(long targetPos) throws IOException
seekToNewSource in interface SeekabletargetPos - position to seek toIOExceptionCopyright © 2014 Apache Software Foundation. All Rights Reserved.