Class NewAttributeBands

java.lang.Object
org.apache.commons.compress.harmony.unpack200.BandSet
org.apache.commons.compress.harmony.unpack200.NewAttributeBands

public class NewAttributeBands extends BandSet
Sets of bands relating to a non-predefined attribute
  • Field Details

  • Constructor Details

  • Method Details

    • getBackwardsCallCount

      public int getBackwardsCallCount()
    • getCodec

      public BHSDCodec getCodec(String layoutElement)
      Returns the BHSDCodec that should be used for the given layout element.
      Parameters:
      layoutElement - TODO
      Returns:
      the BHSDCodec that should be used for the given layout element.
    • getOneAttribute

      private Attribute getOneAttribute(int index, List<NewAttributeBands.AttributeLayoutElement> elements)
      Gets one attribute at the given index from the various bands. The correct bands must have already been read in.
      Parameters:
      index - TODO
      elements - TODO
      Returns:
      attribute at the given index.
    • getStreamUpToMatchingBracket

      private StringReader getStreamUpToMatchingBracket(StringReader stream) throws IOException
      Utility method to get the contents of the given stream, up to the next ], (ignoring pairs of brackets [ and ])
      Parameters:
      stream -
      Returns:
      Throws:
      IOException - If an I/O error occurs.
    • parseAttributes

      public List<Attribute> parseAttributes(InputStream in, int occurrenceCount) throws IOException, Pack200Exception
      Parse the bands relating to this AttributeLayout and return the correct class file attributes as a List of Attribute.
      Parameters:
      in - parse source.
      occurrenceCount - TODO
      Returns:
      Class file attributes as a List of Attribute.
      Throws:
      IOException - If an I/O error occurs.
      Pack200Exception - If a Pack200 semantic error occurs.
    • parseLayout

      private void parseLayout() throws IOException
      Tokenize the layout into AttributeElements
      Throws:
      IOException - If an I/O error occurs.
    • read

      public void read(InputStream in) throws IOException, Pack200Exception
      Description copied from class: BandSet
      Reads the input stream.
      Specified by:
      read in class BandSet
      Parameters:
      in - the stream to read.
      Throws:
      IOException - if a problem occurs during reading from the underlying stream.
      Pack200Exception - if a problem occurs with an unexpected value or unsupported Codec.
    • readBody

      private List<NewAttributeBands.LayoutElement> readBody(StringReader stream) throws IOException
      Reads a 'body' section of the layout from the given stream
      Parameters:
      stream -
      Returns:
      List of LayoutElements
      Throws:
      IOException - If an I/O error occurs.
    • readNextAttributeElement

      private NewAttributeBands.AttributeLayoutElement readNextAttributeElement(StringReader stream) throws IOException
      Throws:
      IOException
    • readNextLayoutElement

      private NewAttributeBands.LayoutElement readNextLayoutElement(StringReader stream) throws IOException
      Throws:
      IOException
    • readNextUnionCase

      private NewAttributeBands.UnionCase readNextUnionCase(StringReader stream) throws IOException
      Reads a UnionCase from the stream.
      Parameters:
      stream - source stream.
      Returns:
      A UnionCase from the stream.
      Throws:
      IOException - If an I/O error occurs.
    • readNumber

      private Integer readNumber(StringReader stream) throws IOException
      Reads a number from the stream and return it
      Parameters:
      stream -
      Returns:
      Throws:
      IOException - If an I/O error occurs.
    • readUpToMatchingBracket

      private String readUpToMatchingBracket(StringReader stream) throws IOException
      Gets the contents of the given stream, up to the next ], (ignoring pairs of brackets [ and ])
      Parameters:
      stream - input stream.
      Returns:
      the contents of the given stream.
      Throws:
      IOException - If an I/O error occurs.
    • resolveCalls

      private void resolveCalls()
      Resolve calls in the attribute layout and returns the number of backwards calls
    • resolveCallsForElement

      private int resolveCallsForElement(int i, NewAttributeBands.Callable currentCallable, NewAttributeBands.LayoutElement layoutElement)
    • setBackwardsCalls

      public void setBackwardsCalls(int[] backwardsCalls) throws IOException
      Once the attribute bands have been read the callables can be informed about the number of times each is subject to a backwards call. This method is used to set this information.
      Parameters:
      backwardsCalls - one int for each backwards callable, which contains the number of times that callable is subject to a backwards call.
      Throws:
      IOException - If an I/O error occurs.
    • unpack

      public void unpack() throws IOException, Pack200Exception
      Description copied from class: BandSet
      Unpacks this instance.
      Specified by:
      unpack in class BandSet
      Throws:
      IOException - if a problem occurs during reading from the underlying stream.
      Pack200Exception - if a problem occurs with an unexpected value or unsupported Codec.