org.apache.hadoop.hdfs.server.namenode
Class INodeFile

java.lang.Object
  extended by org.apache.hadoop.hdfs.server.namenode.INode
      extended by org.apache.hadoop.hdfs.server.namenode.INodeFile
All Implemented Interfaces:
Comparable<byte[]>, org.apache.hadoop.hdfs.server.namenode.FSInodeInfo
Direct Known Subclasses:
INodeFileUnderConstruction

public class INodeFile
extends INode

I-node for closed file.


Field Summary
protected  BlockInfo[] blocks
           
protected  long header
           
 
Fields inherited from class org.apache.hadoop.hdfs.server.namenode.INode
accessTime, modificationTime, name, parent
 
Constructor Summary
protected INodeFile()
           
protected INodeFile(org.apache.hadoop.fs.permission.PermissionStatus permissions, BlockInfo[] blklist, short replication, long modificationTime, long atime, long preferredBlockSize)
           
 
Method Summary
 BlockInfo[] getBlocks()
          Get file blocks
<T extends BlockInfo>
T
getLastBlock()
          Get the last block of the file.
 long getPreferredBlockSize()
          Get preferred block size for the file
 short getReplication()
          Get block replication for the file
 boolean isDirectory()
          Check whether it's a directory
 int numBlocks()
           
 void setBlock(int idx, BlockInfo blk)
          Set file block
protected  void setPermission(org.apache.hadoop.fs.permission.FsPermission permission)
          Set the FsPermission of this INodeFile.
 void setPreferredBlockSize(long preferredBlkSize)
           
 void setReplication(short replication)
           
 
Methods inherited from class org.apache.hadoop.hdfs.server.namenode.INode
compareTo, computeContentSummary, equals, getAccessTime, getFsPermission, getFsPermissionShort, getFullPathName, getGroupName, getModificationTime, getPermissionStatus, getUserName, hashCode, isLink, isUnderConstruction, setGroup, setPermissionStatus, setUser, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

header

protected long header

blocks

protected BlockInfo[] blocks
Constructor Detail

INodeFile

protected INodeFile()

INodeFile

protected INodeFile(org.apache.hadoop.fs.permission.PermissionStatus permissions,
                    BlockInfo[] blklist,
                    short replication,
                    long modificationTime,
                    long atime,
                    long preferredBlockSize)
Method Detail

setPermission

protected void setPermission(org.apache.hadoop.fs.permission.FsPermission permission)
Set the FsPermission of this INodeFile. Since this is a file, the FsAction.EXECUTE action, if any, is ignored.

Overrides:
setPermission in class INode

isDirectory

public boolean isDirectory()
Description copied from class: INode
Check whether it's a directory

Specified by:
isDirectory in class INode

getReplication

public short getReplication()
Get block replication for the file

Returns:
block replication value

setReplication

public void setReplication(short replication)

getPreferredBlockSize

public long getPreferredBlockSize()
Get preferred block size for the file

Returns:
preferred block size in bytes

setPreferredBlockSize

public void setPreferredBlockSize(long preferredBlkSize)

getBlocks

public BlockInfo[] getBlocks()
Get file blocks

Returns:
file blocks

setBlock

public void setBlock(int idx,
                     BlockInfo blk)
Set file block


getLastBlock

public <T extends BlockInfo> T getLastBlock()
                                 throws IOException
Get the last block of the file. Make sure it has the right type.

Throws:
IOException

numBlocks

public int numBlocks()
Returns:
the number of blocks


Copyright © 2013 Apache Software Foundation. All Rights Reserved.