org.xeustechnologies.jtar
Class TarHeader

java.lang.Object
  extended by org.xeustechnologies.jtar.TarHeader

public class TarHeader
extends java.lang.Object

Header

 Offset  Size     Field
 0       100      File name
 100     8        File mode
 108     8        Owner's numeric user ID
 116     8        Group's numeric user ID
 124     12       File size in bytes
 136     12       Last modification time in numeric Unix time format
 148     8        Checksum for header block
 156     1        Link indicator (file type)
 157     100      Name of linked file
 
File Types
 Value        Meaning
 '0'          Normal file
 (ASCII NUL)  Normal file (now obsolete)
 '1'          Hard link
 '2'          Symbolic link
 '3'          Character special
 '4'          Block special
 '5'          Directory
 '6'          FIFO
 '7'          Contigous
 
Ustar header
 Offset  Size    Field
 257     6       UStar indicator "ustar"
 263     2       UStar version "00"
 265     32      Owner user name
 297     32      Owner group name
 329     8       Device major number
 337     8       Device minor number
 345     155     Filename prefix
 


Field Summary
 int checkSum
           
static int CHKSUMLEN
           
static int DEVLEN
           
 int devMajor
           
 int devMinor
           
static int GIDLEN
           
static int GNAMELEN
           
static java.lang.String GNU_TMAGIC
          The magic tag representing a GNU tar archive.
 int groupId
           
 java.lang.StringBuffer groupName
           
static byte LF_BLK
           
static byte LF_CHR
           
static byte LF_CONTIG
           
static byte LF_DIR
           
static byte LF_FIFO
           
static byte LF_LINK
           
static byte LF_NORMAL
           
static byte LF_OLDNORM
           
static byte LF_SYMLINK
           
 byte linkFlag
           
 java.lang.StringBuffer linkName
           
 java.lang.StringBuffer magic
           
static int MAGICLEN
           
 int mode
           
static int MODELEN
           
 long modTime
           
static int MODTIMELEN
           
 java.lang.StringBuffer name
           
static int NAMELEN
           
 long size
           
static int SIZELEN
           
static java.lang.String TMAGIC
          The magic tag representing a POSIX tar archive.
static int UIDLEN
           
static int UNAMELEN
           
 int userId
           
 java.lang.StringBuffer userName
           
 
Constructor Summary
TarHeader()
           
 
Method Summary
static int getNameBytes(java.lang.StringBuffer name, byte[] buf, int offset, int length)
          Determine the number of bytes in an entry name.
static java.lang.StringBuffer parseName(byte[] header, int offset, int length)
          Parse an entry name from a header buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAMELEN

public static final int NAMELEN
See Also:
Constant Field Values

MODELEN

public static final int MODELEN
See Also:
Constant Field Values

UIDLEN

public static final int UIDLEN
See Also:
Constant Field Values

GIDLEN

public static final int GIDLEN
See Also:
Constant Field Values

SIZELEN

public static final int SIZELEN
See Also:
Constant Field Values

MODTIMELEN

public static final int MODTIMELEN
See Also:
Constant Field Values

CHKSUMLEN

public static final int CHKSUMLEN
See Also:
Constant Field Values

LF_OLDNORM

public static final byte LF_OLDNORM
See Also:
Constant Field Values

LF_NORMAL

public static final byte LF_NORMAL
See Also:
Constant Field Values

LF_LINK

public static final byte LF_LINK
See Also:
Constant Field Values

LF_SYMLINK

public static final byte LF_SYMLINK
See Also:
Constant Field Values

LF_CHR

public static final byte LF_CHR
See Also:
Constant Field Values

LF_BLK

public static final byte LF_BLK
See Also:
Constant Field Values

LF_DIR

public static final byte LF_DIR
See Also:
Constant Field Values

LF_FIFO

public static final byte LF_FIFO
See Also:
Constant Field Values

LF_CONTIG

public static final byte LF_CONTIG
See Also:
Constant Field Values

MAGICLEN

public static final int MAGICLEN
See Also:
Constant Field Values

TMAGIC

public static final java.lang.String TMAGIC
The magic tag representing a POSIX tar archive.

See Also:
Constant Field Values

GNU_TMAGIC

public static final java.lang.String GNU_TMAGIC
The magic tag representing a GNU tar archive.

See Also:
Constant Field Values

UNAMELEN

public static final int UNAMELEN
See Also:
Constant Field Values

GNAMELEN

public static final int GNAMELEN
See Also:
Constant Field Values

DEVLEN

public static final int DEVLEN
See Also:
Constant Field Values

name

public java.lang.StringBuffer name

mode

public int mode

userId

public int userId

groupId

public int groupId

size

public long size

modTime

public long modTime

checkSum

public int checkSum

linkFlag

public byte linkFlag

linkName

public java.lang.StringBuffer linkName

magic

public java.lang.StringBuffer magic

userName

public java.lang.StringBuffer userName

groupName

public java.lang.StringBuffer groupName

devMajor

public int devMajor

devMinor

public int devMinor
Constructor Detail

TarHeader

public TarHeader()
Method Detail

parseName

public static java.lang.StringBuffer parseName(byte[] header,
                                               int offset,
                                               int length)
Parse an entry name from a header buffer.

Parameters:
name -
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.

getNameBytes

public static int getNameBytes(java.lang.StringBuffer name,
                               byte[] buf,
                               int offset,
                               int length)
Determine the number of bytes in an entry name.

Parameters:
name -
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 number of bytes in a header's entry name.


Copyright © 2012 Xeus Technologies. All Rights Reserved.