Top Description Inners Fields Constructors Methods
org.apache.commons.compress.harmony.pack200

public Class Archive

extends Object
Class Inheritance
Imports
java.io.BufferedOutputStream, .IOException, .OutputStream, java.util.ArrayList, .List, java.util.jar.JarEntry, .JarFile, .JarInputStream, java.util.zip.GZIPOutputStream, .ZipEntry

Archive is the main entry point to pack200 and represents a packed archive. An archive is constructed with either a JarInputStream and an output stream or a JarFile as input and an OutputStream. Options can be set, then pack() is called, to pack the Jar file into a pack200 archive.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
pack-priv static class

Field Summary

Modifier and TypeField and Description
private long
private static final byte[]
private JarFile
private final JarInputStream
private final PackingOptions
private final OutputStream

Constructor Summary

AccessConstructor and Description
public
Archive(final JarFile
- the input file
jarFile
,
OutputStream
TODO
outputStream
,
PackingOptions
- packing options (if null then defaults are used)
options
)

Creates an Archive with the given input file and a stream for the output

public
Archive(final JarInputStream
TODO
inputStream
,
OutputStream
TODO
outputStream
,
PackingOptions
packing options (if null then defaults are used)
options
)

Creates an Archive with streams for the input and output.

Method Summary

Modifier and TypeMethod and Description
private boolean
addJarEntry(final Archive.PackingFile packingFile, final List<Pack200ClassReader> javaClasses, final List<Archive.PackingFile> files)

private void
private void
private long
estimateSize(final Archive.PackingFile packingFile)

public void
pack()

Packs the archive.

private List<Archive.SegmentUnit>
splitIntoSegments(final List<Archive.PackingFile> packingFileList)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

currentSegmentSizeback to summary
private long currentSegmentSize
EMPTY_BYTE_ARRAYback to summary
private static final byte[] EMPTY_BYTE_ARRAY
jarFileback to summary
private JarFile jarFile
jarInputStreamback to summary
private final JarInputStream jarInputStream
optionsback to summary
private final PackingOptions options
outputStreamback to summary
private final OutputStream outputStream

Constructor Detail

Archiveback to summary
public Archive(final JarFile jarFile, OutputStream outputStream, PackingOptions options) throws IOException

Creates an Archive with the given input file and a stream for the output

Parameters
jarFile:JarFile

- the input file

outputStream:OutputStream

TODO

options:PackingOptions

- packing options (if null then defaults are used)

Exceptions
IOException:
If an I/O error occurs.
Archiveback to summary
public Archive(final JarInputStream inputStream, OutputStream outputStream, PackingOptions options) throws IOException

Creates an Archive with streams for the input and output.

Parameters
inputStream:JarInputStream

TODO

outputStream:OutputStream

TODO

options:PackingOptions

packing options (if null then defaults are used)

Exceptions
IOException:
If an I/O error occurs.

Method Detail

addJarEntryback to summary
private boolean addJarEntry(final Archive.PackingFile packingFile, final List<Pack200ClassReader> javaClasses, final List<Archive.PackingFile> files)
doNormalPackback to summary
private void doNormalPack() throws IOException, Pack200Exception
doZeroEffortPackback to summary
private void doZeroEffortPack() throws IOException
estimateSizeback to summary
private long estimateSize(final Archive.PackingFile packingFile)
packback to summary
public void pack() throws Pack200Exception, IOException

Packs the archive.

Exceptions
Pack200Exception:
TODO
IOException:
If an I/O error occurs.
splitIntoSegmentsback to summary
private List<Archive.SegmentUnit> splitIntoSegments(final List<Archive.PackingFile> packingFileList)
org.apache.commons.compress.harmony.pack200 back to summary

pack-priv Class Archive.PackingFile

extends Object
Class Inheritance
  • java.lang.Object
  • org.apache.commons.compress.harmony.pack200.Archive.PackingFile

Field Summary

Modifier and TypeField and Description
private byte[]
private final boolean
private final boolean
private final long
private final String

Constructor Summary

AccessConstructor and Description
pack-priv
PackingFile(final byte[] bytes, final JarEntry jarEntry)

pack-priv
PackingFile(final String name, final byte[] contents, final long modtime)

Method Summary

Modifier and TypeMethod and Description
public byte[]
public long
public String
public boolean
public boolean
public void
setContents(final byte[] contents)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

contentsback to summary
private byte[] contents
deflateHintback to summary
private final boolean deflateHint
isDirectoryback to summary
private final boolean isDirectory
modtimeback to summary
private final long modtime
nameback to summary
private final String name

Constructor Detail

PackingFileback to summary
pack-priv PackingFile(final byte[] bytes, final JarEntry jarEntry)
PackingFileback to summary
pack-priv PackingFile(final String name, final byte[] contents, final long modtime)

Method Detail

getContentsback to summary
public byte[] getContents()
getModtimeback to summary
public long getModtime()
getNameback to summary
public String getName()
isDefalteHintback to summary
public boolean isDefalteHint()
isDirectoryback to summary
public boolean isDirectory()
setContentsback to summary
public void setContents(final byte[] contents)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
org.apache.commons.compress.harmony.pack200 back to summary

pack-priv Class Archive.SegmentUnit

extends Object
Class Inheritance
  • java.lang.Object
  • org.apache.commons.compress.harmony.pack200.Archive.SegmentUnit

Field Summary

Modifier and TypeField and Description
private int
private final List<Pack200ClassReader>
private final List<Archive.PackingFile>
private int

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
addPackedByteAmount(final int amount)

public int
public int
public int
public List<Pack200ClassReader>
public List<Archive.PackingFile>
public int
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

byteAmountback to summary
private int byteAmount
classListback to summary
private final List<Pack200ClassReader> classList
fileListback to summary
private final List<Archive.PackingFile> fileList
packedByteAmountback to summary
private int packedByteAmount

Constructor Detail

SegmentUnitback to summary
pack-priv SegmentUnit(final List<Pack200ClassReader> classes, final List<Archive.PackingFile> files)

Method Detail

addPackedByteAmountback to summary
public void addPackedByteAmount(final int amount)
classListSizeback to summary
public int classListSize()
fileListSizeback to summary
public int fileListSize()
getByteAmountback to summary
public int getByteAmount()
getClassListback to summary
public List<Pack200ClassReader> getClassList()
getFileListback to summary
public List<Archive.PackingFile> getFileList()
getPackedByteAmountback to summary
public int getPackedByteAmount()