java.lang.Object
kala.compress.harmony.unpack200.SegmentHeader

public class SegmentHeader extends Object
SegmentHeader is the header band of a Segment
  • Field Details

    • 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 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 Details

    • SegmentHeader

      public SegmentHeader(Segment segment)
  • 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 from
      codec - the codec for this scalar
      Returns:
      the decoded value
      Throws:
      IOException - if there is a problem reading from the underlying input stream
      Pack200Exception - 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 from
      codec - the codec for this scalar
      Returns:
      an array of decoded long[] values
      Throws:
      IOException - if there is a problem reading from the underlying input stream
      Pack200Exception - 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 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(InputStream in) throws IOException, Pack200Exception
      Throws:
      IOException
      Pack200Exception
    • parseArchiveSpecialCounts

      private void parseArchiveSpecialCounts(InputStream in) throws IOException, Pack200Exception
      Throws:
      IOException
      Pack200Exception
    • parseClassCounts

      private void parseClassCounts(InputStream in) throws IOException, Pack200Exception
      Throws:
      IOException
      Pack200Exception
    • parseCpCounts

      private void parseCpCounts(InputStream in) throws IOException, Pack200Exception
      Throws:
      IOException
      Pack200Exception
    • read

      public void read(InputStream in) throws IOException, Error, Pack200Exception
      Throws:
      IOException
      Error
      Pack200Exception
    • setArchiveMajorVersion

      private void setArchiveMajorVersion(int version) throws Pack200Exception
      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

      private void setArchiveMinorVersion(int version) throws Pack200Exception
      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()