Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
Object
com.ice.tar.TarHeader
public class TarHeader
extends Object
implements Cloneable
Field Summary | |
static int |
|
static int |
|
static int |
|
static int |
|
static String |
|
static byte |
|
static byte |
|
static byte |
|
static byte |
|
static byte |
|
static byte |
|
static byte |
|
static byte |
|
static byte |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static String |
|
static int |
|
static int |
|
int |
|
int |
|
int |
|
int |
|
StringBuffer |
|
byte |
|
StringBuffer |
|
StringBuffer |
|
long |
|
int |
|
StringBuffer |
|
long |
|
int |
|
StringBuffer |
|
Constructor Summary | |
Method Summary | |
Object |
|
static int |
|
static int |
|
static int |
|
String |
|
static int |
|
static int |
|
static StringBuffer |
|
static StringBuffer |
|
static long |
|
public static final int CHKSUMLEN
The length of the checksum field in a header buffer.
- Field Value:
- 8
public static final int DEVLEN
The length of the devices field in a header buffer.
- Field Value:
- 8
public static final int GIDLEN
The length of the group id field in a header buffer.
- Field Value:
- 8
public static final int GNAMELEN
The length of the group name field in a header buffer.
- Field Value:
- 32
public static final String GNU_TMAGIC
The magic tag representing a GNU tar archive.
public static final byte LF_BLK
Block device file type.
- Field Value:
- 52
public static final byte LF_CHR
Character device file type.
- Field Value:
- 51
public static final byte LF_CONTIG
Contiguous file type.
- Field Value:
- 55
public static final byte LF_DIR
Directory file type.
- Field Value:
- 53
public static final byte LF_FIFO
FIFO (pipe) file type.
- Field Value:
- 54
public static final byte LF_LINK
Link file type.
- Field Value:
- 49
public static final byte LF_NORMAL
Normal file type.
- Field Value:
- 48
public static final byte LF_OLDNORM
LF_ constants represent the "link flag" of an entry, or more commonly, the "entry type". This is the "old way" of indicating a normal file.
- Field Value:
- 0
public static final byte LF_SYMLINK
Symbolic link file type.
- Field Value:
- 50
public static final int MAGICLEN
The length of the magic field in a header buffer.
- Field Value:
- 8
public static final int MODELEN
The length of the mode field in a header buffer.
- Field Value:
- 8
public static final int MODTIMELEN
The length of the modification time field in a header buffer.
- Field Value:
- 12
public static final int NAMELEN
The length of the name field in a header buffer.
- Field Value:
- 100
public static final int NAMEOFFSET
The offset of the name field in a header buffer.
- Field Value:
- 0
public static final int PREFIXLEN
The length of the name prefix field in a header buffer.
- Field Value:
- 155
public static final int PREFIXOFFSET
The offset of the name prefix field in a header buffer.
- Field Value:
- 345
public static final int SIZELEN
The length of the size field in a header buffer.
- Field Value:
- 12
public static final String TMAGIC
The magic tag representing a POSIX tar archive.
public static final int UIDLEN
The length of the user id field in a header buffer.
- Field Value:
- 8
public static final int UNAMELEN
The length of the user name field in a header buffer.
- Field Value:
- 32
public int checkSum
The entry's checksum.
public int devMajor
The entry's major device number.
public int devMinor
The entry's minor device number.
public int groupId
The entry's group id.
public StringBuffer groupName
The entry's group name.
public byte linkFlag
The entry's link flag.
public StringBuffer linkName
The entry's link name.
public StringBuffer magic
The entry's magic tag.
public long modTime
The entry's modification time.
public int mode
The entry's permission mode.
public StringBuffer name
The entry's name.
public long size
The entry's size.
public int userId
The entry's user id.
public StringBuffer userName
The entry's user name.
public Object clone()
TarHeaders can be cloned.
public static int getCheckSumOctalBytes(long value, byte[] buf, int offset, int length)
Parse the checksum octal integer from a header buffer.
- Parameters:
offset
- The offset into the buffer from which to parse.length
- The number of header bytes to parse.
- Returns:
- The integer value of the entry's checksum.
public static int getFileNameBytes(String newName, byte[] outbuf) throws InvalidHeaderException
This method, like getNameBytes(), is intended to place a name into a TarHeader's buffer. However, this method is sophisticated enough to recognize long names (name.length() > NAMELEN). In these cases, the method will break the name into a prefix and suffix and place the name in the header in 'ustar' format. It is up to the TarEntry to manage the "entry header format". This method assumes the name is valid for the type of archive being generated.
- Parameters:
newName
- The new name to place into the header buffer.outbuf
- The buffer containing the entry header to modify.
- Returns:
- The current offset in the tar header (always TarHeader.NAMELEN).
- Throws:
InvalidHeaderException
- If the name will not fit in the header.
public static int getLongOctalBytes(long value, byte[] buf, int offset, int length)
Parse an octal long integer from a header buffer.
- Parameters:
offset
- The offset into the buffer from which to parse.length
- The number of header bytes to parse.
- Returns:
- The long value of the octal bytes.
public String getName()
Get the name of this entry.
- Returns:
- Teh entry's name.
public static int getNameBytes(StringBuffer name, byte[] buf, int offset, int length)
Move the bytes from the name StringBuffer into the header's buffer.
- Parameters:
offset
- The offset into the buffer at which to store.length
- The number of header bytes to store.
- Returns:
- The new offset (offset + length).
public static int getOctalBytes(long value, byte[] buf, int offset, int length)
Parse an octal integer from a header buffer.
- Parameters:
offset
- The offset into the buffer from which to parse.length
- The number of header bytes to parse.
- Returns:
- The integer value of the octal bytes.
public static StringBuffer parseFileName(byte[] header)
Parse a file name from a header buffer. This is different from parseName() in that is recognizes 'ustar' names and will handle adding on the "prefix" field to the name. Contributed by Dmitri Tikhonov <dxt2431@yahoo.com>
- Parameters:
header
- The header buffer from which to parse.
- Returns:
- The header's entry name.
public static StringBuffer parseName(byte[] header, int offset, int length) throws InvalidHeaderException
Parse an entry name from a header buffer.
- Parameters:
header
- The header buffer from which to parse.offset
- The offset into the buffer from which to parse.length
- The number of header bytes to parse.
- Returns:
- The header's entry name.
public static long parseOctal(byte[] header, int offset, int length) throws InvalidHeaderException
Parse an octal string from a header buffer. This is used for the file permission mode value.
- Parameters:
header
- The header buffer from which to parse.offset
- The offset into the buffer from which to parse.length
- The number of header bytes to parse.
- Returns:
- The long value of the octal string.