Package kala.compress.harmony.unpack200
Class SegmentHeader
java.lang.Object
kala.compress.harmony.unpack200.SegmentHeader
SegmentHeader is the header band of a
Segment-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprivate intprivate longprivate longprivate intprivate intprivate InputStreamprivate intprivate intprivate intprivate intprivate intprivate intprivate intprivate intprivate intprivate intprivate intprivate intprivate intprivate intprivate intprivate intprivate static final byte[]private intprivate static final int[]The magic header for a Pack200 Segment is 0xCAFED00D.private intprivate SegmentOptionsprivate final Segmentprivate int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate intdecodeScalar(String name, InputStream in, BHSDCodec codec) Decode a scalar from the band file.private int[]decodeScalar(String name, InputStream in, BHSDCodec codec, int n) Decode a number of scalars from the band file.longlongintintObtain the band headers data as an input stream.intintintintintintintintintintintintintintintintintintintprivate voidprivate voidprivate voidprivate voidvoidread(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 Details
-
EMPTY_BYTE_ARRAY
private static final byte[] EMPTY_BYTE_ARRAY -
magic
private static final int[] magicThe 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
-
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
-
segment
-
archiveSizeOffset
private int archiveSizeOffset
-
-
Constructor Details
-
SegmentHeader
-
-
Method Details
-
decodeScalar
private int decodeScalar(String name, InputStream in, BHSDCodec codec) throws IOException, Pack200Exception Decode 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:
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(String name, InputStream in, BHSDCodec codec, int n) throws IOException, Pack200Exception Decode 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:
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
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
-
getSegmentsRemaining
public int getSegmentsRemaining() -
parseArchiveFileCounts
- Throws:
IOExceptionPack200Exception
-
parseArchiveSpecialCounts
- Throws:
IOExceptionPack200Exception
-
parseClassCounts
- Throws:
IOExceptionPack200Exception
-
parseCpCounts
- Throws:
IOExceptionPack200Exception
-
read
- Throws:
IOExceptionErrorPack200Exception
-
setArchiveMajorVersion
Sets the major version of this archive.- Parameters:
version- the minor version of the archive- Throws:
Pack200Exception- if the major version is not 150
-
setArchiveMinorVersion
Sets 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()
-