Class LocatedBlocks

java.lang.Object
org.apache.hadoop.hdfs.protocol.LocatedBlocks

@Private @Evolving public class LocatedBlocks extends Object
Collection of blocks with their locations and the file length.
  • 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

      public List<LocatedBlock> getLocatedBlocks()
      Get located blocks.
    • getLastLocatedBlock

      public LocatedBlock getLastLocatedBlock()
      Get the last located block.
    • isLastBlockComplete

      public boolean isLastBlockComplete()
      Is the last block completed?
    • get

      public LocatedBlock get(int index)
      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

      public ErasureCodingPolicy 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

      public void insertRange(int blockIdx, List<LocatedBlock> newBlocks)
    • getInsertIndex

      public static int getInsertIndex(int binSearchResult)
    • toString

      public String toString()
      Overrides:
      toString in class Object