Package kala.compress.harmony.unpack200
Class SegmentHeader
- java.lang.Object
-
- kala.compress.harmony.unpack200.SegmentHeader
-
public class SegmentHeader extends java.lang.ObjectSegmentHeader is the header band of aSegment
-
-
Field Summary
Fields Modifier and Type Field Description private intarchiveMajorprivate intarchiveMinorprivate longarchiveModtimeprivate longarchiveSizeprivate intarchiveSizeOffsetprivate intattributeDefinitionCountprivate java.io.InputStreambandHeadersInputStreamprivate intbandHeadersSizeprivate intclassCountprivate intcpClassCountprivate intcpDescriptorCountprivate intcpDoubleCountprivate intcpFieldCountprivate intcpFloatCountprivate intcpIMethodCountprivate intcpIntCountprivate intcpLongCountprivate intcpMethodCountprivate intcpSignatureCountprivate intcpStringCountprivate intcpUTF8Countprivate intdefaultClassMajorVersionprivate intdefaultClassMinorVersionprivate static byte[]EMPTY_BYTE_ARRAYprivate intinnerClassCountprivate static int[]magicThe magic header for a Pack200 Segment is 0xCAFED00D.private intnumberOfFilesprivate SegmentOptionsoptionsprivate Segmentsegmentprivate intsegmentsRemaining
-
Constructor Summary
Constructors Constructor Description SegmentHeader(Segment segment)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private intdecodeScalar(java.lang.String name, java.io.InputStream in, BHSDCodec codec)Decode a scalar from the band file.private int[]decodeScalar(java.lang.String name, java.io.InputStream in, BHSDCodec codec, int n)Decode a number of scalars from the band file.longgetArchiveModtime()longgetArchiveSize()intgetArchiveSizeOffset()intgetAttributeDefinitionCount()java.io.InputStreamgetBandHeadersInputStream()Obtain the band headers data as an input stream.intgetBandHeadersSize()intgetClassCount()intgetCpClassCount()intgetCpDescriptorCount()intgetCpDoubleCount()intgetCpFieldCount()intgetCpFloatCount()intgetCpIMethodCount()intgetCpIntCount()intgetCpLongCount()intgetCpMethodCount()intgetCpSignatureCount()intgetCpStringCount()intgetCpUTF8Count()intgetDefaultClassMajorVersion()intgetDefaultClassMinorVersion()intgetInnerClassCount()intgetNumberOfFiles()SegmentOptionsgetOptions()intgetSegmentsRemaining()private voidparseArchiveFileCounts(java.io.InputStream in)private voidparseArchiveSpecialCounts(java.io.InputStream in)private voidparseClassCounts(java.io.InputStream in)private voidparseCpCounts(java.io.InputStream in)voidread(java.io.InputStream in)private voidsetArchiveMajorVersion(int version)Sets the major version of this archive.private voidsetArchiveMinorVersion(int version)Sets the minor version of this archivevoidsetArchiveModtime(long archiveModtime)voidsetArchiveSize(long archiveSize)private voidsetAttributeDefinitionCount(long valuie)private voidsetBandHeadersData(byte[] bandHeaders)voidsetSegmentsRemaining(long value)voidunpack()
-
-
-
Field Detail
-
EMPTY_BYTE_ARRAY
private static final byte[] EMPTY_BYTE_ARRAY
-
magic
private static final int[] magic
The magic header for a Pack200 Segment is 0xCAFED00D. I wonder where they get their inspiration from ...
-
archiveMajor
private int archiveMajor
-
archiveMinor
private int archiveMinor
-
archiveModtime
private long archiveModtime
-
archiveSize
private long archiveSize
-
attributeDefinitionCount
private int attributeDefinitionCount
-
bandHeadersInputStream
private java.io.InputStream bandHeadersInputStream
-
bandHeadersSize
private int bandHeadersSize
-
classCount
private int classCount
-
cpClassCount
private int cpClassCount
-
cpDescriptorCount
private int cpDescriptorCount
-
cpDoubleCount
private int cpDoubleCount
-
cpFieldCount
private int cpFieldCount
-
cpFloatCount
private int cpFloatCount
-
cpIMethodCount
private int cpIMethodCount
-
cpIntCount
private int cpIntCount
-
cpLongCount
private int cpLongCount
-
cpMethodCount
private int cpMethodCount
-
cpSignatureCount
private int cpSignatureCount
-
cpStringCount
private int cpStringCount
-
cpUTF8Count
private int cpUTF8Count
-
defaultClassMajorVersion
private int defaultClassMajorVersion
-
defaultClassMinorVersion
private int defaultClassMinorVersion
-
innerClassCount
private int innerClassCount
-
numberOfFiles
private int numberOfFiles
-
segmentsRemaining
private int segmentsRemaining
-
options
private SegmentOptions options
-
segment
private final Segment segment
-
archiveSizeOffset
private int archiveSizeOffset
-
-
Constructor Detail
-
SegmentHeader
public SegmentHeader(Segment segment)
-
-
Method Detail
-
decodeScalar
private int decodeScalar(java.lang.String name, java.io.InputStream in, BHSDCodec codec) throws java.io.IOException, Pack200ExceptionDecode a scalar from the band file. A scalar is like a band, but does not perform any band code switching.- Parameters:
name- the name of the scalar (primarily for logging/debugging purposes)in- the input stream to read fromcodec- the codec for this scalar- Returns:
- the decoded value
- Throws:
java.io.IOException- if there is a problem reading from the underlying input streamPack200Exception- if there is a problem decoding the value or that the value is invalid
-
decodeScalar
private int[] decodeScalar(java.lang.String name, java.io.InputStream in, BHSDCodec codec, int n) throws java.io.IOException, Pack200ExceptionDecode a number of scalars from the band file. A scalar is like a band, but does not perform any band code switching.- Parameters:
name- the name of the scalar (primarily for logging/debugging purposes)in- the input stream to read fromcodec- the codec for this scalar- Returns:
- an array of decoded
long[]values - Throws:
java.io.IOException- if there is a problem reading from the underlying input streamPack200Exception- if there is a problem decoding the value or that the value is invalid
-
getArchiveModtime
public long getArchiveModtime()
-
getArchiveSize
public long getArchiveSize()
-
getArchiveSizeOffset
public int getArchiveSizeOffset()
-
getAttributeDefinitionCount
public int getAttributeDefinitionCount()
-
getBandHeadersInputStream
public java.io.InputStream getBandHeadersInputStream()
Obtain the band headers data as an input stream. If no band headers are present, this will return an empty input stream to prevent any further reads taking place. Note that as a stream, data consumed from this input stream can't be re-used. Data is only read from this stream if the encoding is such that additional information needs to be decoded from the stream itself.- Returns:
- the band headers input stream
-
getBandHeadersSize
public int getBandHeadersSize()
-
getClassCount
public int getClassCount()
-
getCpClassCount
public int getCpClassCount()
-
getCpDescriptorCount
public int getCpDescriptorCount()
-
getCpDoubleCount
public int getCpDoubleCount()
-
getCpFieldCount
public int getCpFieldCount()
-
getCpFloatCount
public int getCpFloatCount()
-
getCpIMethodCount
public int getCpIMethodCount()
-
getCpIntCount
public int getCpIntCount()
-
getCpLongCount
public int getCpLongCount()
-
getCpMethodCount
public int getCpMethodCount()
-
getCpSignatureCount
public int getCpSignatureCount()
-
getCpStringCount
public int getCpStringCount()
-
getCpUTF8Count
public int getCpUTF8Count()
-
getDefaultClassMajorVersion
public int getDefaultClassMajorVersion()
-
getDefaultClassMinorVersion
public int getDefaultClassMinorVersion()
-
getInnerClassCount
public int getInnerClassCount()
-
getNumberOfFiles
public int getNumberOfFiles()
-
getOptions
public SegmentOptions getOptions()
-
getSegmentsRemaining
public int getSegmentsRemaining()
-
parseArchiveFileCounts
private void parseArchiveFileCounts(java.io.InputStream in) throws java.io.IOException, Pack200Exception- Throws:
java.io.IOExceptionPack200Exception
-
parseArchiveSpecialCounts
private void parseArchiveSpecialCounts(java.io.InputStream in) throws java.io.IOException, Pack200Exception- Throws:
java.io.IOExceptionPack200Exception
-
parseClassCounts
private void parseClassCounts(java.io.InputStream in) throws java.io.IOException, Pack200Exception- Throws:
java.io.IOExceptionPack200Exception
-
parseCpCounts
private void parseCpCounts(java.io.InputStream in) throws java.io.IOException, Pack200Exception- Throws:
java.io.IOExceptionPack200Exception
-
read
public void read(java.io.InputStream in) throws java.io.IOException, java.lang.Error, Pack200Exception- Throws:
java.io.IOExceptionjava.lang.ErrorPack200Exception
-
setArchiveMajorVersion
private void setArchiveMajorVersion(int version) throws Pack200ExceptionSets the major version of this archive.- Parameters:
version- the minor version of the archive- Throws:
Pack200Exception- if the major version is not 150
-
setArchiveMinorVersion
private void setArchiveMinorVersion(int version) throws Pack200ExceptionSets the minor version of this archive- Parameters:
version- the minor version of the archive- Throws:
Pack200Exception- if the minor version is not 7
-
setArchiveModtime
public void setArchiveModtime(long archiveModtime)
-
setArchiveSize
public void setArchiveSize(long archiveSize)
-
setAttributeDefinitionCount
private void setAttributeDefinitionCount(long valuie)
-
setBandHeadersData
private void setBandHeadersData(byte[] bandHeaders)
-
setSegmentsRemaining
public void setSegmentsRemaining(long value)
-
unpack
public void unpack()
-
-