- java.lang.Object
-
- kala.compress.harmony.pack200.Archive
-
public class Archive extends java.lang.ObjectArchive 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, thenpack()is called, to pack the Jar file into a pack200 archive.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classArchive.PackingFile(package private) static classArchive.SegmentUnit
-
Field Summary
Fields Modifier and Type Field Description private longcurrentSegmentSizeprivate static byte[]EMPTY_BYTE_ARRAYprivate java.util.jar.JarFilejarFileprivate java.util.jar.JarInputStreamjarInputStreamprivate PackingOptionsoptionsprivate java.io.OutputStreamoutputStream
-
Constructor Summary
Constructors Constructor Description Archive(java.util.jar.JarFile jarFile, java.io.OutputStream outputStream, PackingOptions options)Creates an Archive with the given input file and a stream for the outputArchive(java.util.jar.JarInputStream inputStream, java.io.OutputStream outputStream, PackingOptions options)Creates an Archive with streams for the input and output.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private booleanaddJarEntry(Archive.PackingFile packingFile, java.util.List<Pack200ClassReader> javaClasses, java.util.List<Archive.PackingFile> files)private voiddoNormalPack()private voiddoZeroEffortPack()private longestimateSize(Archive.PackingFile packingFile)voidpack()Packs the archive.private java.util.List<Archive.SegmentUnit>splitIntoSegments(java.util.List<Archive.PackingFile> packingFileList)
-
-
-
Field Detail
-
EMPTY_BYTE_ARRAY
private static final byte[] EMPTY_BYTE_ARRAY
-
jarInputStream
private final java.util.jar.JarInputStream jarInputStream
-
outputStream
private final java.io.OutputStream outputStream
-
jarFile
private java.util.jar.JarFile jarFile
-
currentSegmentSize
private long currentSegmentSize
-
options
private final PackingOptions options
-
-
Constructor Detail
-
Archive
public Archive(java.util.jar.JarFile jarFile, java.io.OutputStream outputStream, PackingOptions options) throws java.io.IOExceptionCreates an Archive with the given input file and a stream for the output- Parameters:
jarFile- the input fileoutputStream- TODOoptions- packing options (if null then defaults are used)- Throws:
java.io.IOException- If an I/O error occurs.
-
Archive
public Archive(java.util.jar.JarInputStream inputStream, java.io.OutputStream outputStream, PackingOptions options) throws java.io.IOExceptionCreates an Archive with streams for the input and output.- Parameters:
inputStream- TODOoutputStream- TODOoptions- packing options (if null then defaults are used)- Throws:
java.io.IOException- If an I/O error occurs.
-
-
Method Detail
-
addJarEntry
private boolean addJarEntry(Archive.PackingFile packingFile, java.util.List<Pack200ClassReader> javaClasses, java.util.List<Archive.PackingFile> files)
-
doNormalPack
private void doNormalPack() throws java.io.IOException, Pack200Exception- Throws:
java.io.IOExceptionPack200Exception
-
doZeroEffortPack
private void doZeroEffortPack() throws java.io.IOException- Throws:
java.io.IOException
-
estimateSize
private long estimateSize(Archive.PackingFile packingFile)
-
pack
public void pack() throws Pack200Exception, java.io.IOExceptionPacks the archive.- Throws:
Pack200Exception- TODOjava.io.IOException- If an I/O error occurs.
-
splitIntoSegments
private java.util.List<Archive.SegmentUnit> splitIntoSegments(java.util.List<Archive.PackingFile> packingFileList)
-
-