2.17.2: 2011-06-17

net.sf.basedb.util.zip
Class TarUtil

java.lang.Object
  extended by net.sf.basedb.util.zip.TarUtil

public class TarUtil
extends Object

Contains utility functions for TAR archives. Most importantly functions for handling entries with too long file names to fit in the header section.

Version:
2.5.1
Author:
nicklas
Last modified
$Date: 2008-09-11 22:08:14 +0200 (Thu, 11 Sep 2008) $

Field Summary
private static byte LONG_LINK_FLAG
          The TAR header flag that must be set for @LongLink entries.
static String LONG_LINK_NAME
          TAR has a limit of 100 characters in file names.
static int MAX_NAME_LENGTH
          Maximum file name length.
 
Constructor Summary
TarUtil()
           
 
Method Summary
static com.ice.tar.TarEntry getNextEntry(com.ice.tar.TarInputStream tarStream)
          Get the next entry from a TAR input stream.
static void putNextEntry(com.ice.tar.TarEntry entry, com.ice.tar.TarOutputStream tarStream)
          Put the next entry to a TAR stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LONG_LINK_NAME

public static final String LONG_LINK_NAME
TAR has a limit of 100 characters in file names. Names that are longer store the actual filename in an entry with this name just before the real file (which usually has a truncated name entry).

See Also:
Constant Field Values

MAX_NAME_LENGTH

public static final int MAX_NAME_LENGTH
Maximum file name length.

See Also:
LONG_LINK_NAME, Constant Field Values

LONG_LINK_FLAG

private static byte LONG_LINK_FLAG
The TAR header flag that must be set for @LongLink entries.

Constructor Detail

TarUtil

public TarUtil()
Method Detail

getNextEntry

public static final com.ice.tar.TarEntry getNextEntry(com.ice.tar.TarInputStream tarStream)
                                               throws IOException
Get the next entry from a TAR input stream. This method has support for long filenames. After calling this method the actual file data can be read from the stream.

Parameters:
tarStream - The TAR stream to read from
Returns:
The next entry or null if the end of stream has been reached
Throws:
IOException

putNextEntry

public static final void putNextEntry(com.ice.tar.TarEntry entry,
                                      com.ice.tar.TarOutputStream tarStream)
                               throws IOException
Put the next entry to a TAR stream. This method has support for long filenames and will automatically create all neccesary extra information inside the TAR stream. After calling this method the actual file data should be written to the stream.

Parameters:
entry - The next entry
tarStream - The tar stream to write to
Throws:
IOException

2.17.2: 2011-06-17