|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
java.io.FilterInputStream
java.io.DataInputStream
org.apache.hadoop.fs.FSDataInputStream
@InterfaceAudience.Public @InterfaceStability.Stable public class FSDataInputStream
Utility that wraps a FSInputStream
in a DataInputStream
and buffers input through a BufferedInputStream
.
Field Summary |
---|
Fields inherited from class java.io.FilterInputStream |
---|
in |
Constructor Summary | |
---|---|
FSDataInputStream(InputStream in)
|
Method Summary | |
---|---|
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)
See readFully(long, byte[], int, int) . |
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. |
Methods inherited from class java.io.DataInputStream |
---|
read, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, readUTF, skipBytes |
Methods inherited from class java.io.FilterInputStream |
---|
available, close, mark, markSupported, read, reset, skip |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.io.Closeable |
---|
close |
Constructor Detail |
---|
public FSDataInputStream(InputStream in) throws IOException
IOException
Method Detail |
---|
public void seek(long desired) throws IOException
seek
in interface Seekable
desired
- offset to seek to
IOException
public long getPos() throws IOException
getPos
in interface Seekable
IOException
public int read(long position, byte[] buffer, int offset, int length) throws IOException
read
in interface PositionedReadable
position
- 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
reached
IOException
public void readFully(long position, byte[] buffer, int offset, int length) throws IOException
length
bytes have been read.
readFully
in interface PositionedReadable
position
- 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 read
EOFException
- 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.
IOException
public void readFully(long position, byte[] buffer) throws IOException
readFully(long, byte[], int, int)
.
readFully
in interface PositionedReadable
IOException
public boolean seekToNewSource(long targetPos) throws IOException
seekToNewSource
in interface Seekable
targetPos
- position to seek to
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |