eap.tar
Class TarHeader

java.lang.Object
  extended byeap.tar.TarHeader

public class TarHeader
extends Object

Holds information about a single entry in a tar file. Each entry in a tar file has a 512 byte header describing the entry. The end of a tar file is marked by two consecutive 512 byte blocks which are all set to zero.


Field Summary
static int BLOCK_SPECIAL_DEV_TYPE
           
static int CHARACTER_SPECIAL_DEV_TYPE
           
static int DIRECTORY_TYPE
           
static int FIFO_TYPE
           
static int FILE_TYPE
           
static int HARD_LINK_TYPE
           
static int SYMBOLIC_LINK_TYPE
           
 
Constructor Summary
TarHeader()
          Create a new header.
 
Method Summary
 String getFormat()
          Returns the format of this tar file.
 String getName()
          Returns the name of the tar entry.
 long getSize()
          Returns the number of bytes in the tar entry.
 boolean isDirectory()
          Returns true if the entry is a directory.
 boolean isEOF()
          Returns true if the header is actuall the all zero EOF marker at the end of a tar.
 boolean isFile()
          Returns true if the entry is a regular file.
 void read(InputStream in)
          Read the contents of this header from a data stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILE_TYPE

public static final int FILE_TYPE
See Also:
Constant Field Values

HARD_LINK_TYPE

public static final int HARD_LINK_TYPE
See Also:
Constant Field Values

SYMBOLIC_LINK_TYPE

public static final int SYMBOLIC_LINK_TYPE
See Also:
Constant Field Values

CHARACTER_SPECIAL_DEV_TYPE

public static final int CHARACTER_SPECIAL_DEV_TYPE
See Also:
Constant Field Values

BLOCK_SPECIAL_DEV_TYPE

public static final int BLOCK_SPECIAL_DEV_TYPE
See Also:
Constant Field Values

DIRECTORY_TYPE

public static final int DIRECTORY_TYPE
See Also:
Constant Field Values

FIFO_TYPE

public static final int FIFO_TYPE
See Also:
Constant Field Values
Constructor Detail

TarHeader

public TarHeader()
Create a new header. This header must be read with the read(InputStream) method before it can be used.

Method Detail

getName

public String getName()
Returns the name of the tar entry.

Returns:
The name of the tar entry.

getSize

public long getSize()
Returns the number of bytes in the tar entry.

Returns:
the number of bytes in the tar entry.

getFormat

public String getFormat()
Returns the format of this tar file. There are two possible formats. The only difference between them is that the newer POSIX format contains some additional information in the header.

Returns:
"UNIX" if this is an old BSD style tar heder, or "USTAR" if this is a newer POSIX format tar file.

isDirectory

public boolean isDirectory()
Returns true if the entry is a directory.

Returns:
true if the entry is a directory.

isFile

public boolean isFile()
Returns true if the entry is a regular file.

Returns:
true if the entry is a regular file.

isEOF

public boolean isEOF()
Returns true if the header is actuall the all zero EOF marker at the end of a tar.


read

public void read(InputStream in)
          throws IOException
Read the contents of this header from a data stream.

Parameters:
in - The stream from which to read the header.
Throws:
IOException