Package org.apache.commons.compress.harmony.pack200

# Class Segment

java.lang.Object
org.objectweb.asm.ClassVisitor
org.apache.commons.compress.harmony.pack200.Segment

public class Segment extends org.objectweb.asm.ClassVisitor
A Pack200 archive consists of one or more Segments.

Format:

       pack200_archive:
          (pack200_segment)+

       pack200_segment:
          segment_header
          *band_headers :BYTE1
          cp_bands
          attr_definition_bands
          ic_bands
          class_bands
          bc_bands
          file_bands

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `class`
  `Segment.ArrayVisitor`
  `static class`
  `Segment.PassException`
  Exception indicating that the class currently being visited contains an unknown attribute, which means that by default the class file needs to be passed through as-is in the file_bands rather than being packed with pack200.
  `class`
  `Segment.SegmentAnnotationVisitor`
  SegmentAnnotationVisitor implements `AnnotationVisitor` to visit Annotations found in a class file.
  `class`
  `Segment.SegmentFieldVisitor`
  SegmentFieldVisitor implements `FieldVisitor` to visit the metadata relating to fields in a class file.
  `class`
  `Segment.SegmentMethodVisitor`
  This class implements MethodVisitor to visit the contents and metadata related to methods in a class file.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static int`
  `ASM_API`
  See https://asm.ow2.io/Javadoc/org/objectweb/asm/Opcodes.html#ASM4

  ### Fields inherited from class org.objectweb.asm.ClassVisitor

  `api, cv`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Segment()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `AttributeDefinitionBands`
  `getAttrBands()`
  `ClassBands`
  `getClassBands()`
  `CpBands`
  `getCpBands()`
  `Pack200ClassReader`
  `getCurrentClassReader()`
  `IcBands`
  `getIcBands()`
  `SegmentHeader`
  `getSegmentHeader()`
  `boolean`
  `lastConstantHadWideIndex()`
  `void`
  `pack(org.apache.commons.compress.harmony.pack200.Archive.SegmentUnit segmentUnit, OutputStream out, PackingOptions options)`
  The main method on Segment.
  `void`
  `visit(int version, int access, String name, String signature, String superName, String[] interfaces)`
  `org.objectweb.asm.AnnotationVisitor`
  `visitAnnotation(String desc, boolean visible)`
  `void`
  `visitAttribute(org.objectweb.asm.Attribute attribute)`
  `void`
  `visitEnd()`
  `org.objectweb.asm.FieldVisitor`
  `visitField(int flags, String name, String desc, String signature, Object value)`
  `void`
  `visitInnerClass(String name, String outerName, String innerName, int flags)`
  `org.objectweb.asm.MethodVisitor`
  `visitMethod(int flags, String name, String desc, String signature, String[] exceptions)`
  `void`
  `visitOuterClass(String owner, String name, String desc)`
  `void`
  `visitSource(String source, String debug)`

  ### Methods inherited from class org.objectweb.asm.ClassVisitor

  `getDelegate, visitModule, visitNestHost, visitNestMember, visitPermittedSubclass, visitRecordComponent, visitTypeAnnotation`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### ASM_API

    public static int ASM_API
    See https://asm.ow2.io/Javadoc/org/objectweb/asm/Opcodes.html#ASM4

- ## Constructor Details

  - ### Segment

    public Segment()

- ## Method Details

  - ### getAttrBands

    public AttributeDefinitionBands getAttrBands()

  - ### getClassBands

    public ClassBands getClassBands()

  - ### getCpBands

    public CpBands getCpBands()

  - ### getCurrentClassReader

    public Pack200ClassReader getCurrentClassReader()

  - ### getIcBands

    public IcBands getIcBands()

  - ### getSegmentHeader

    public SegmentHeader getSegmentHeader()

  - ### lastConstantHadWideIndex

    public boolean lastConstantHadWideIndex()

  - ### pack

    public void pack(org.apache.commons.compress.harmony.pack200.Archive.SegmentUnit segmentUnit, OutputStream out, PackingOptions options) throws IOException, Pack200Exception
    The main method on Segment. Reads in all the class files, packs them and then writes the packed segment out to the given OutputStream.
    Parameters:
      `segmentUnit` - TODO
      `out` - the OutputStream to write the packed Segment to.
      `options` - packing options.
    Throws:
      `IOException` - If an I/O error occurs.
      `Pack200Exception` - If a Pack200 semantic error occurs.

  - ### visit

    public void visit(int version, int access, String name, String signature, String superName, String[] interfaces)
    Overrides:
      `visit` in class `org.objectweb.asm.ClassVisitor`

  - ### visitAnnotation

    public org.objectweb.asm.AnnotationVisitor visitAnnotation(String desc, boolean visible)
    Overrides:
      `visitAnnotation` in class `org.objectweb.asm.ClassVisitor`

  - ### visitAttribute

    public void visitAttribute(org.objectweb.asm.Attribute attribute)
    Overrides:
      `visitAttribute` in class `org.objectweb.asm.ClassVisitor`

  - ### visitEnd

    public void visitEnd()
    Overrides:
      `visitEnd` in class `org.objectweb.asm.ClassVisitor`

  - ### visitField

    public org.objectweb.asm.FieldVisitor visitField(int flags, String name, String desc, String signature, Object value)
    Overrides:
      `visitField` in class `org.objectweb.asm.ClassVisitor`

  - ### visitInnerClass

    public void visitInnerClass(String name, String outerName, String innerName, int flags)
    Overrides:
      `visitInnerClass` in class `org.objectweb.asm.ClassVisitor`

  - ### visitMethod

    public org.objectweb.asm.MethodVisitor visitMethod(int flags, String name, String desc, String signature, String[] exceptions)
    Overrides:
      `visitMethod` in class `org.objectweb.asm.ClassVisitor`

  - ### visitOuterClass

    public void visitOuterClass(String owner, String name, String desc)
    Overrides:
      `visitOuterClass` in class `org.objectweb.asm.ClassVisitor`

  - ### visitSource

    public void visitSource(String source, String debug)
    Overrides:
      `visitSource` in class `org.objectweb.asm.ClassVisitor`