org.apache.hadoop.hdfs.protocol
Class LocatedBlocks

java.lang.Object
  extended by org.apache.hadoop.hdfs.protocol.LocatedBlocks
All Implemented Interfaces:
org.apache.hadoop.io.Writable

@InterfaceAudience.Private
@InterfaceStability.Evolving
public class LocatedBlocks
extends Object
implements org.apache.hadoop.io.Writable

Collection of blocks with their locations and the file length.


Constructor Summary
LocatedBlocks(long flength, boolean isUnderConstuction, List<LocatedBlock> blks, LocatedBlock lastBlock, boolean isLastBlockCompleted)
          public Constructor
 
Method Summary
 int findBlock(long offset)
          Find block containing specified offset.
 LocatedBlock get(int index)
          Get located block.
 long getFileLength()
           
static int getInsertIndex(int binSearchResult)
           
 LocatedBlock getLastLocatedBlock()
          Get the last located block.
 List<LocatedBlock> getLocatedBlocks()
          Get located blocks.
 void insertRange(int blockIdx, List<LocatedBlock> newBlocks)
           
 boolean isLastBlockComplete()
          Is the last block completed?
 boolean isUnderConstruction()
          Return ture if file was under construction when this LocatedBlocks was constructed, false otherwise.
 int locatedBlockCount()
          Get number of located blocks.
 void readFields(DataInput in)
           
 String toString()
          
 void write(DataOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LocatedBlocks

public LocatedBlocks(long flength,
                     boolean isUnderConstuction,
                     List<LocatedBlock> blks,
                     LocatedBlock lastBlock,
                     boolean isLastBlockCompleted)
public Constructor

Method Detail

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 ture if file was under construction when this LocatedBlocks was constructed, false 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)

write

public void write(DataOutput out)
           throws IOException
Specified by:
write in interface org.apache.hadoop.io.Writable
Throws:
IOException

readFields

public void readFields(DataInput in)
                throws IOException
Specified by:
readFields in interface org.apache.hadoop.io.Writable
Throws:
IOException

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2009 The Apache Software Foundation