rossi.fstools.fs.ext2fs
Class Ext2File

java.lang.Object
  extended byrossi.fstools.fs.ext2fs.Ext2File
All Implemented Interfaces:
File, FsObject

public class Ext2File
extends java.lang.Object
implements File

Representation of a file.


Field Summary
protected  java.util.List blkPointerList
           
protected  BlockReader reader
           
protected  Ext2SuperBlock sb
           
protected  long size
           
protected  long sizeRemaining
           
protected  java.util.List slackList
           
 
Constructor Summary
Ext2File(Ext2SuperBlock sb, long fileSize, BlockReader reader)
          Create a file.
 
Method Summary
 void addDirectBlock(long blocknum)
          Adds the specified block to the file.
 void addIndirectBlock(long blocknum, int level)
           
 BlockPointerInputStream getData()
          Get a BlockPointerInputStream to the data contained within the file.
 BlockPointerInputStream getSlack()
          Get a BlockPointerInputStream to the slack space contained at the end of the file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

blkPointerList

protected java.util.List blkPointerList

slackList

protected java.util.List slackList

size

protected long size

sizeRemaining

protected long sizeRemaining

reader

protected BlockReader reader

sb

protected Ext2SuperBlock sb
Constructor Detail

Ext2File

public Ext2File(Ext2SuperBlock sb,
                long fileSize,
                BlockReader reader)
Create a file.

Parameters:
sb - a Ext2SuperBlock
fileSize - The length of the file from its Inode.
reader - a BlockReader to read the disk.
Method Detail

addDirectBlock

public void addDirectBlock(long blocknum)
Adds the specified block to the file.

Parameters:
blocknum - block number of the block to be added.

addIndirectBlock

public void addIndirectBlock(long blocknum,
                             int level)
                      throws java.io.IOException
Parameters:
blocknum - the block number of the (single, double, tripply) indirect block
level - of indirection -- 0 = direct, 1 = first indirect...
Throws:
java.io.IOException

getData

public BlockPointerInputStream getData()
Description copied from interface: File
Get a BlockPointerInputStream to the data contained within the file.

Specified by:
getData in interface File
Returns:
BlockPointerInputStream - an input stream of the file's data.
See Also:
BlockPointerInputStream

getSlack

public BlockPointerInputStream getSlack()
Description copied from interface: File
Get a BlockPointerInputStream to the slack space contained at the end of the file.

Specified by:
getSlack in interface File
Returns:
BlockPointerInputStream - an input stream of the file's slack data.
See Also:
BlockPointerInputStream