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, org.apache.hadoop.fs.ByteBufferReadable, org.apache.hadoop.fs.CanSetDropBehind, org.apache.hadoop.fs.CanSetReadahead, org.apache.hadoop.fs.HasEnhancedByteBufferAccess, org.apache.hadoop.fs.HasFileDescriptor, org.apache.hadoop.fs.PositionedReadable, org.apache.hadoop.fs.Seekable
- Direct Known Subclasses:
- DFSClient.DFSDataInputStream
@InterfaceAudience.Public
@InterfaceStability.Evolving
public class HdfsDataInputStream
- extends org.apache.hadoop.fs.FSDataInputStream
The Hdfs implementation of FSDataInputStream
.
Methods inherited from class org.apache.hadoop.fs.FSDataInputStream |
getFileDescriptor, getPos, read, read, read, read, readFully, readFully, releaseBuffer, seek, seekToNewSource, setDropBehind, setReadahead |
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.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
HdfsDataInputStream
public HdfsDataInputStream(org.apache.hadoop.hdfs.DFSInputStream in)
throws IOException
- Throws:
IOException
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
public List<org.apache.hadoop.hdfs.protocol.LocatedBlock> getAllBlocks()
throws IOException
- Get the collection of blocks that has already been located.
- Throws:
IOException
getVisibleLength
public long getVisibleLength()
throws IOException
- 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.
- Throws:
IOException
getReadStatistics
public DFSInputStream.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.
Copyright © 2014 Apache Software Foundation. All Rights Reserved.