org.apache.hadoop.fs
Class BlockLocation

java.lang.Object
  extended by org.apache.hadoop.fs.BlockLocation
All Implemented Interfaces:
Writable

public class BlockLocation
extends Object
implements Writable


Constructor Summary
BlockLocation()
          Default Constructor
BlockLocation(String[] names, String[] hosts, long offset, long length)
          Constructor with host, name, offset and length
BlockLocation(String[] names, String[] hosts, String[] topologyPaths, long offset, long length)
          Constructor with host, name, network topology, offset and length
 
Method Summary
 String[] getHosts()
          Get the list of hosts (hostname) hosting this block
 long getLength()
          Get the length of the block
 String[] getNames()
          Get the list of names (hostname:port) hosting this block
 long getOffset()
          Get the start offset of file associated with this block
 String[] getTopologyPaths()
          Get the list of network topology paths for each of the hosts.
 void readFields(DataInput in)
          Implement readFields of Writable
 void setHosts(String[] hosts)
          Set the hosts hosting this block
 void setLength(long length)
          Set the length of block
 void setNames(String[] names)
          Set the names (host:port) hosting this block
 void setOffset(long offset)
          Set the start offset of file associated with this block
 void setTopologyPaths(String[] topologyPaths)
          Set the network topology paths of the hosts
 String toString()
           
 void write(DataOutput out)
          Implement write of Writable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BlockLocation

public BlockLocation()
Default Constructor


BlockLocation

public BlockLocation(String[] names,
                     String[] hosts,
                     long offset,
                     long length)
Constructor with host, name, offset and length


BlockLocation

public BlockLocation(String[] names,
                     String[] hosts,
                     String[] topologyPaths,
                     long offset,
                     long length)
Constructor with host, name, network topology, offset and length

Method Detail

getHosts

public String[] getHosts()
                  throws IOException
Get the list of hosts (hostname) hosting this block

Throws:
IOException

getNames

public String[] getNames()
                  throws IOException
Get the list of names (hostname:port) hosting this block

Throws:
IOException

getTopologyPaths

public String[] getTopologyPaths()
                          throws IOException
Get the list of network topology paths for each of the hosts. The last component of the path is the host.

Throws:
IOException

getOffset

public long getOffset()
Get the start offset of file associated with this block


getLength

public long getLength()
Get the length of the block


setOffset

public void setOffset(long offset)
Set the start offset of file associated with this block


setLength

public void setLength(long length)
Set the length of block


setHosts

public void setHosts(String[] hosts)
              throws IOException
Set the hosts hosting this block

Throws:
IOException

setNames

public void setNames(String[] names)
              throws IOException
Set the names (host:port) hosting this block

Throws:
IOException

setTopologyPaths

public void setTopologyPaths(String[] topologyPaths)
                      throws IOException
Set the network topology paths of the hosts

Throws:
IOException

write

public void write(DataOutput out)
           throws IOException
Implement write of Writable

Specified by:
write in interface Writable
Parameters:
out - DataOuput to serialize this object into.
Throws:
IOException

readFields

public void readFields(DataInput in)
                throws IOException
Implement readFields of Writable

Specified by:
readFields in interface Writable
Parameters:
in - DataInput to deseriablize this object from.
Throws:
IOException

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2009 The Apache Software Foundation