Package org.apache.hadoop.hdfs.protocol
Class LocatedBlocks
java.lang.Object
org.apache.hadoop.hdfs.protocol.LocatedBlocks
Collection of blocks with their locations and the file length.
-
Constructor Summary
ConstructorsConstructorDescriptionLocatedBlocks(long flength, boolean isUnderConstuction, List<LocatedBlock> blks, LocatedBlock lastBlock, boolean isLastBlockCompleted, org.apache.hadoop.fs.FileEncryptionInfo feInfo, ErasureCodingPolicy ecPolicy) -
Method Summary
Modifier and TypeMethodDescriptionintfindBlock(long offset) Find block containing specified offset.get(int index) Get located block.org.apache.hadoop.fs.FileEncryptionInfolongstatic intgetInsertIndex(int binSearchResult) Get the last located block.Get located blocks.voidinsertRange(int blockIdx, List<LocatedBlock> newBlocks) booleanIs the last block completed?booleanReturn true if file was under construction when this LocatedBlocks was constructed, false otherwise.intGet number of located blocks.toString()
-
Constructor Details
-
LocatedBlocks
public LocatedBlocks() -
LocatedBlocks
public LocatedBlocks(long flength, boolean isUnderConstuction, List<LocatedBlock> blks, LocatedBlock lastBlock, boolean isLastBlockCompleted, org.apache.hadoop.fs.FileEncryptionInfo feInfo, ErasureCodingPolicy ecPolicy)
-
-
Method Details
-
getLocatedBlocks
Get located blocks. -
getLastLocatedBlock
Get the last located block. -
isLastBlockComplete
public boolean isLastBlockComplete()Is the last block completed? -
get
Get located block. -
locatedBlockCount
public int locatedBlockCount()Get number of located blocks. -
getFileLength
public long getFileLength() -
isUnderConstruction
public boolean isUnderConstruction()Return true if file was under construction when this LocatedBlocks was constructed, false otherwise. -
getFileEncryptionInfo
public org.apache.hadoop.fs.FileEncryptionInfo getFileEncryptionInfo()- Returns:
- the FileEncryptionInfo for the LocatedBlocks
-
getErasureCodingPolicy
- Returns:
- The ECPolicy for ErasureCoded file, null otherwise.
-
findBlock
public int findBlock(long offset) Find block containing specified offset.- Returns:
- block if found, or null otherwise.
-
insertRange
-
getInsertIndex
public static int getInsertIndex(int binSearchResult) -
toString
-