org.at4j.tar
Class TarFileParser

java.lang.Object
  extended by org.at4j.tar.TarFileParser

public final class TarFileParser
extends Object

The Tar file parser is used to parse a Tar file. It reads through data it gets from a DataSource, parses Tar entry headers, and then uses a delegate object of the type TarEntryHandlerDelegate to handle the entry in some way. TarFile uses this to build a map of the Tar file structure that it keeps in memory, and TarExtractor uses this to extract the Tar entries.

The Tar file parser object is stateless. Instead of instantiating it, the singleton instance INSTANCE may be used.

Since:
1.0
Author:
Karl Gustafsson

Field Summary
static TarFileParser INSTANCE
           
 
Method Summary
 void parse(DataSource src, Charset fileNameCharset, TarEntryHandlerDelegate entryHandler)
          Parse the Tar file data read from the data source.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final TarFileParser INSTANCE
Method Detail

parse

public void parse(DataSource src,
                  Charset fileNameCharset,
                  TarEntryHandlerDelegate entryHandler)
           throws TarFileParseException,
                  WrappedIOException
Parse the Tar file data read from the data source.

Parameters:
src - The data source.
fileNameCharset - The charset to use for decoding entry names.
entryHandler - The delegate object that handles each parsed entry.
Throws:
TarFileParseException - On parse errors.
WrappedIOException - On I/O errors.