|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jguild.jrpm.io.cpio.CPIOEntry
A cpio archive consists of a sequence of files. There are several types of headers defided in two categories of new and old format. The headers are recognized by magic numbers: "070701" ascii for "new" portable format "070702" ascii for "new" portable format with CRC format "070707" ascii for old ascii "070707" short for old binary CPIO 2.5 knows also about tar, but it is not recognized here. OLD FORMAT: Each file has a 76(ascii)/26(binary) byte header, a variable length, NUL terminated filename, and variable length file data. A header for a filename "TRAILER!!!" indicates the end of the archive. All the fields in the header are ISO 646 (approximately ASCII) strings of octal numbers, left padded, not NUL terminated. Field Name Length in Bytes Notes ASCII / BINARY c_magic 6 / 2 c_dev 6 / 2 Device that contains a directory entry for this file c_ino 6 / 2 I-node number that identifies the input file to the file system c_mode 6 / 2 Mode of the input file c_uid 6 / 2 User ID of the owner of the input file c_gid 6 / 2 Group ID of the owner of the input file c_nlink 6 / 2 Number of links that are connected to the input file c_rdev 6 / 2 ID of the remote device from which the input file is taken only valid for chr and blk special files c_mtime 11 / 4 Time when data was last modified. For remote files, this field contains the time at the server c_namesize 6 / 2 Length of the path name, including the terminating null byte c_filesize 11 / 4 Length of the file in bytes. This is the length of the data section that follows the header structure. Must be 0 for FIFOs and directories Special files, directories, and the trailer are recorded with the h_filesize field equal to 0. NEW FORMAT: Each file has a 110 byte header, a variable length, NUL terminated filename, and variable length file data. A header for a filename "TRAILER!!!" indicates the end of the archive. All the fields in the header are ISO 646 (approximately ASCII) strings of hexadecimal numbers, left padded, not NUL terminated. Field Name Length in Bytes Notes c_magic 6 c_ino 8 c_mode 8 c_uid 8 c_gid 8 c_nlink 8 c_mtime 8 c_filesize 8 must be 0 for FIFOs and directories c_maj 8 c_min 8 c_rmaj 8 only valid for chr and blk special files c_rmin 8 only valid for chr and blk special files c_namesize 8 count includes terminating NUL in pathname c_chksum 8 0 for "new" portable format; for CRC format the sum of all the bytes in the file
Field Summary |
Fields inherited from interface com.jguild.jrpm.io.cpio.CPIOConstants |
C_IRGRP, C_IROTH, C_IRUSR, C_ISBLK, C_ISCHR, C_ISDIR, C_ISFIFO, C_ISGID, C_ISLNK, C_ISNWK, C_ISREG, C_ISSOCK, C_ISUID, C_ISVTX, C_IWGRP, C_IWOTH, C_IWUSR, C_IXGRP, C_IXOTH, C_IXUSR, FORMAT_NEW, FORMAT_NEW_CRC, FORMAT_NEW_MASK, FORMAT_OLD_ASCII, FORMAT_OLD_BINARY, FORMAT_OLD_MASK, MAGIC_NEW, MAGIC_NEW_CRC, MAGIC_OLD_ASCII, MAGIC_OLD_BINARY, S_IFMT |
Constructor Summary | |
CPIOEntry()
Ceates a CPIOEntry without a cpio format. |
|
CPIOEntry(short format)
Ceates a CPIOEntry with a specified format. |
|
CPIOEntry(java.lang.String name)
Ceates a CPIOEntry with a specified name. |
Method Summary | |
long |
getChksum()
Get the checksum. |
long |
getDevice()
Get the device id. |
long |
getDeviceMaj()
Get the major device id. |
long |
getDeviceMin()
Get the minor device id |
long |
getFileSize()
Get the filesize. |
short |
getFormat()
Get the format for this entry. |
long |
getGID()
Get the group id. |
long |
getHeaderSize()
Get the size of this entry on the stream |
long |
getInode()
Set the inode. |
long |
getMode()
Get the mode of this entry (e.g. directory, regular file). |
java.lang.String |
getName()
Get the name. |
long |
getNumberOfLinks()
Get the number of links. |
long |
getRemoteDevice()
Get the remote device id. |
long |
getRemoteDeviceMaj()
Get the remote major device id. |
long |
getRemoteDeviceMin()
Get the remote minor device id. |
long |
getTime()
Get the time in seconds. |
long |
getUID()
Get the user id. |
boolean |
isBlockDevice()
Check if this entry represents a block device. |
boolean |
isCharacterDevice()
Check if this entry represents a character device. |
boolean |
isDirectory()
Check if this entry represents a directory. |
boolean |
isNetwork()
Check if this entry represents a network device. |
boolean |
isPipe()
Check if this entry represents a pipe. |
boolean |
isRegularFile()
Check if this entry represents a regular file. |
boolean |
isSocket()
Check if this entry represents a socket. |
boolean |
isSymbolicLink()
Check if this entry represents a symbolic link. |
void |
setChksum(long chksum)
Set the checksum. |
void |
setDevice(long device)
Set the device id. |
void |
setDeviceMaj(long maj)
Set major device id. |
void |
setDeviceMin(long min)
Set the minor device id |
void |
setFileSize(long size)
Set the filesize. |
(package private) void |
setFormat(short format)
Set the format for this entry. |
void |
setGID(long gid)
Set the group id. |
void |
setInode(long inode)
Set the inode. |
void |
setMode(long mode)
Set the mode of this entry (e.g. directory, regular file). |
void |
setName(java.lang.String name)
Set the name. |
void |
setNumberOfLinks(long nlink)
Set the number of links. |
void |
setRemoteDevice(long device)
Set the remote device id. |
void |
setRemoteDeviceMaj(long rmaj)
Set the remote major device id. |
void |
setRemoteDeviceMin(long rmin)
Set the remote minor device id. |
void |
setTime(long time)
Set the time in seconds. |
void |
setUID(long uid)
Set the user id. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public CPIOEntry()
public CPIOEntry(short format)
format
- The cpio format for this entry.public CPIOEntry(java.lang.String name)
name
- The name of this entry.Method Detail |
public long getChksum()
public long getDevice()
java.lang.UnsupportedOperationException
- if this method is called
for a CPIOEntry with a new format.public long getDeviceMaj()
java.lang.UnsupportedOperationException
- if this method is called
for a CPIOEntry with an old format.public long getDeviceMin()
public long getFileSize()
public short getFormat()
public long getGID()
public long getHeaderSize()
public long getInode()
public long getMode()
public java.lang.String getName()
public long getNumberOfLinks()
public long getRemoteDevice()
java.lang.UnsupportedOperationException
- if this method is called
for a CPIOEntry with a new format.public long getRemoteDeviceMaj()
java.lang.UnsupportedOperationException
- if this method is called
for a CPIOEntry with an old format.public long getRemoteDeviceMin()
java.lang.UnsupportedOperationException
- if this method is called
for a CPIOEntry with an old format.public long getTime()
public long getUID()
public boolean isBlockDevice()
public boolean isCharacterDevice()
public boolean isDirectory()
public boolean isNetwork()
public boolean isPipe()
public boolean isRegularFile()
public boolean isSocket()
public boolean isSymbolicLink()
public void setChksum(long chksum)
chksum
- The checksum to set.public void setDevice(long device)
device
- The device id to set.
java.lang.UnsupportedOperationException
- if this method is called
for a CPIOEntry with a new format.public void setDeviceMaj(long maj)
maj
- The major device id to set.public void setDeviceMin(long min)
min
- The minor device id to set.public void setFileSize(long size)
size
- The filesize to set.void setFormat(short format)
format
- The format to set.public void setGID(long gid)
gid
- The group id to set.public void setInode(long inode)
inode
- The inode to set.public void setMode(long mode)
mode
- The mode to set.public void setName(java.lang.String name)
name
- The name to set.public void setNumberOfLinks(long nlink)
nlink
- The number of links to set.public void setRemoteDevice(long device)
device
- The remote device id to set.
java.lang.UnsupportedOperationException
- if this method is called
for a CPIOEntry with a new format.public void setRemoteDeviceMaj(long rmaj)
rmaj
- The remote major device id to set.
java.lang.UnsupportedOperationException
- if this method is called
for a CPIOEntry with an old format.public void setRemoteDeviceMin(long rmin)
rmin
- The remote minor device id to set.
java.lang.UnsupportedOperationException
- if this method is called
for a CPIOEntry with an old format.public void setTime(long time)
time
- The time to set.public void setUID(long uid)
uid
- The user id to set.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |