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.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
.
Method Summary |
List<org.apache.hadoop.hdfs.protocol.LocatedBlock> |
getAllBlocks()
Get the collection of blocks that has already been located. |
org.apache.hadoop.hdfs.protocol.ExtendedBlock |
getCurrentBlock()
Get the block containing the target position. |
org.apache.hadoop.hdfs.protocol.DatanodeInfo |
getCurrentDatanode()
Get the datanode from which the stream is currently reading. |
long |
getVisibleLength()
Get the visible length of the file. |
Methods inherited from class org.apache.hadoop.fs.FSDataInputStream |
getFileDescriptor, getPos, read, read, readFully, readFully, seek, seekToNewSource |
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
Copyright © 2012 Apache Software Foundation. All Rights Reserved.