Package org.apache.hadoop.hdfs.client
Class HdfsDataInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
java.io.DataInputStream
org.apache.hadoop.fs.FSDataInputStream
org.apache.hadoop.hdfs.client.HdfsDataInputStream
- All Implemented Interfaces:
Closeable,DataInput,AutoCloseable,ByteBufferPositionedReadable,ByteBufferReadable,CanSetDropBehind,CanSetReadahead,CanUnbuffer,org.apache.hadoop.fs.HasEnhancedByteBufferAccess,org.apache.hadoop.fs.HasFileDescriptor,PositionedReadable,Seekable,org.apache.hadoop.fs.statistics.IOStatisticsSource,StreamCapabilities
The Hdfs implementation of
FSDataInputStream.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.hadoop.fs.StreamCapabilities
StreamCapabilities.StreamCapability -
Field Summary
Fields inherited from class java.io.FilterInputStream
inFields inherited from interface org.apache.hadoop.fs.StreamCapabilities
ABORTABLE_STREAM, DROPBEHIND, HFLUSH, HSYNC, IOSTATISTICS, IOSTATISTICS_CONTEXT, PREADBYTEBUFFER, READAHEAD, READBYTEBUFFER, UNBUFFER, VECTOREDIO, VECTOREDIO_BUFFERS_SLICED -
Constructor Summary
ConstructorsConstructorDescriptionHdfsDataInputStream(org.apache.hadoop.crypto.CryptoInputStream in) HdfsDataInputStream(org.apache.hadoop.hdfs.DFSInputStream in) -
Method Summary
Modifier and TypeMethodDescriptionvoidList<org.apache.hadoop.hdfs.protocol.LocatedBlock>Get the collection of blocks that has already been located.org.apache.hadoop.hdfs.protocol.ExtendedBlockGet the block containing the target position.org.apache.hadoop.hdfs.protocol.DatanodeInfoGet the datanode from which the stream is currently reading.org.apache.hadoop.hdfs.ReadStatisticsGet statistics about the reads which this DFSInputStream has done.longGet the visible length of the file.Get a reference to the wrapped output stream.Methods inherited from class org.apache.hadoop.fs.FSDataInputStream
getFileDescriptor, getIOStatistics, getPos, hasCapability, maxReadSizeForVectorReads, minSeekForVectorReads, read, read, read, read, read, readFully, readFully, readFully, readVectored, readVectored, releaseBuffer, seek, seekToNewSource, setDropBehind, setReadahead, toString, unbufferMethods inherited from class java.io.DataInputStream
read, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, readUTF, skipBytesMethods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, read, reset, skipMethods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Constructor Details
-
HdfsDataInputStream
public HdfsDataInputStream(org.apache.hadoop.hdfs.DFSInputStream in) -
HdfsDataInputStream
public HdfsDataInputStream(org.apache.hadoop.crypto.CryptoInputStream in)
-
-
Method Details
-
getWrappedStream
Get a reference to the wrapped output stream. We always want to return the actual underlying InputStream, even when we're using a CryptoStream. e.g. in the delegated methods below.- Overrides:
getWrappedStreamin classFSDataInputStream- Returns:
- the underlying output stream
-
getCurrentDatanode
public org.apache.hadoop.hdfs.protocol.DatanodeInfo getCurrentDatanode()Get the datanode from which the stream is currently reading. -
getCurrentBlock
public org.apache.hadoop.hdfs.protocol.ExtendedBlock getCurrentBlock()Get the block containing the target position. -
getAllBlocks
Get the collection of blocks that has already been located.- Throws:
IOException
-
getVisibleLength
public long getVisibleLength()Get the visible length of the file. It will include the length of the last block even if that is in UnderConstruction state.- Returns:
- The visible length of the file.
-
getReadStatistics
public org.apache.hadoop.hdfs.ReadStatistics getReadStatistics()Get statistics about the reads which this DFSInputStream has done. Note that because HdfsDataInputStream is buffered, these stats may be higher than you would expect just by adding up the number of bytes read through HdfsDataInputStream. -
clearReadStatistics
public void clearReadStatistics()
-