com.threerings.jpkg.ar
Class Archive

java.lang.Object
  extended by com.threerings.jpkg.ar.Archive

public class Archive
extends Object

Creates and works with Unix ar(1) archives.

See Also:
The Wikipedia ar (Unix) entry

Field Summary
static byte[] AR_MAGIC
          The magic header which starts every ar archive.
static String CHAR_ENCODING
          The character encoding all text added to the archive will be translated into.
static int FILE_HEADER_LENGTH
          The length of the header that appears before every file in the archive.
static byte[] PADDING
          The byte used to pad data.
 
Constructor Summary
Archive(File path)
          Construct a new archive at the supplied File path.
 
Method Summary
 void appendEntry(ArchiveEntry entry)
          Append the contents of the supplied ArchiveEntry to this archive.
protected  void finalize()
          Make sure the OutputStream gets closed.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHAR_ENCODING

public static final String CHAR_ENCODING
The character encoding all text added to the archive will be translated into.

See Also:
Constant Field Values

AR_MAGIC

public static final byte[] AR_MAGIC
The magic header which starts every ar archive.


PADDING

public static final byte[] PADDING
The byte used to pad data.


FILE_HEADER_LENGTH

public static final int FILE_HEADER_LENGTH
The length of the header that appears before every file in the archive.

See Also:
Constant Field Values
Constructor Detail

Archive

public Archive(File path)
        throws InvalidMagicException,
               IOException
Construct a new archive at the supplied File path. If the path already exists and is an ar(1) archive, open the archive for appending.

Throws:
InvalidMagicException - If the file being appended to is an invalid ar(1) archive.
IOException - If any exception occurs during file i/o.
Method Detail

appendEntry

public void appendEntry(ArchiveEntry entry)
                 throws PathnameInvalidException,
                        PathnameTooLongException,
                        DataTooLargeException,
                        IOException
Append the contents of the supplied ArchiveEntry to this archive.

Parameters:
entry - The ArchiveEntry to add to the archive.
Throws:
PathnameTooLongException - If the path name is too long for an ar(1) archive.
PathnameInvalidException - If the path name is invalid, e.g. contains a space.
DataTooLargeException - If the data contained in the entry is too large for an ar(1) archive.
IOException - If any exception occurs during data i/o.

finalize

protected void finalize()
                 throws Throwable
Make sure the OutputStream gets closed.

Overrides:
finalize in class Object
Throws:
Throwable


Copyright © 2007-2008 Three Rings Design, Inc. All Rights Reserved. Released under a BSD license.