rossi.fstools.fs.ext2fs
Class DirEntry

java.lang.Object
  extended byrossi.fstools.fs.ext2fs.DirEntry
All Implemented Interfaces:
DiskStructure

public class DirEntry
extends java.lang.Object
implements DiskStructure

Representation of a directory entry.

  On disk the directory entry looks like this:

        31        24        16       8       0
        --------------------------------------
  0000  |           Inode                    |
        --------------------------------------
  0004  |  Record Len       |NameLen | Type  |
        --------------------------------------
  0008  |        Name...                     |
        --------------------------------------
 


Field Summary
static int EXT2_FT_BLKDEV
          Block device type
static int EXT2_FT_CHRDEV
          Character device type
static int EXT2_FT_DIR
          Directory type
static int EXT2_FT_FIFO
          Fifo type
static int EXT2_FT_REG_FILE
          Regular file type
static int EXT2_FT_SOCK
          Socket type
static int EXT2_FT_SYMLINK
          Symlink type
static int EXT2_FT_UNKNOWN
          File type is unknown
protected  long inode
           
protected  java.lang.String name
           
protected  int nameLen
           
protected  int recordLen
           
protected  int type
           
 
Constructor Summary
DirEntry()
           
 
Method Summary
 int getDataSize()
          Get the size of this DirEntry.
 long getInode()
          Get the Inode number associated with this direntry.
 java.lang.String getName()
           
 int getNameLen()
          Get the length of the name in this record.
 int getRecordLen()
          Get the length of this record.
 int getType()
          Get the type of this file for EXT3 filesystem which support it.
 void loadFromBuffer(byte[] buffer, int offset)
          Loads the object from a memory buffer
 void setInode(long aInode)
           
 void setName(java.lang.String aName)
           
 void setNameLen(int aNameLen)
           
 void setRecordLen(int aRecordLen)
           
 void setType(int aType)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

inode

protected long inode

recordLen

protected int recordLen

nameLen

protected int nameLen

type

protected int type

name

protected java.lang.String name

EXT2_FT_UNKNOWN

public static final int EXT2_FT_UNKNOWN
File type is unknown

See Also:
Constant Field Values

EXT2_FT_REG_FILE

public static final int EXT2_FT_REG_FILE
Regular file type

See Also:
Constant Field Values

EXT2_FT_DIR

public static final int EXT2_FT_DIR
Directory type

See Also:
Constant Field Values

EXT2_FT_CHRDEV

public static final int EXT2_FT_CHRDEV
Character device type

See Also:
Constant Field Values

EXT2_FT_BLKDEV

public static final int EXT2_FT_BLKDEV
Block device type

See Also:
Constant Field Values

EXT2_FT_FIFO

public static final int EXT2_FT_FIFO
Fifo type

See Also:
Constant Field Values

EXT2_FT_SOCK

public static final int EXT2_FT_SOCK
Socket type

See Also:
Constant Field Values

EXT2_FT_SYMLINK

public static final int EXT2_FT_SYMLINK
Symlink type

See Also:
Constant Field Values
Constructor Detail

DirEntry

public DirEntry()
Method Detail

getDataSize

public int getDataSize()
Get the size of this DirEntry. Note that dir entries are variable sized.

Specified by:
getDataSize in interface DiskStructure
Returns:
size

getInode

public long getInode()
Get the Inode number associated with this direntry.

Returns:
inode number

setInode

public void setInode(long aInode)

getRecordLen

public int getRecordLen()
Get the length of this record.

Returns:
record length

setRecordLen

public void setRecordLen(int aRecordLen)

getNameLen

public int getNameLen()
Get the length of the name in this record.

Returns:
name length

setNameLen

public void setNameLen(int aNameLen)

getName

public java.lang.String getName()

setName

public void setName(java.lang.String aName)

getType

public int getType()
Get the type of this file for EXT3 filesystem which support it. Must have feature EXT2_FEATURE_INCOMPAT_FILETYPE set in the superblock.

Returns:
type

setType

public void setType(int aType)

loadFromBuffer

public void loadFromBuffer(byte[] buffer,
                           int offset)
                    throws FsException
Description copied from interface: DiskStructure
Loads the object from a memory buffer

Specified by:
loadFromBuffer in interface DiskStructure
Parameters:
buffer - a byte[] containing data to be read in populating the object
offset - a int indicating the offset within the buffer to start parsing.
Throws:
FsException - if a parse error occurs.