Class NewAttributeBands


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

      • NewAttributeBands

        public NewAttributeBands​(Segment segment,
                                 AttributeLayout attributeLayout)
                          throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • getBackwardsCallCount

        public int getBackwardsCallCount()
      • getCodec

        public BHSDCodec getCodec​(java.lang.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,
                                          java.util.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 java.io.StringReader getStreamUpToMatchingBracket​(java.io.StringReader stream)
                                                           throws java.io.IOException
        Utility method to get the contents of the given stream, up to the next ], (ignoring pairs of brackets [ and ])
        Parameters:
        stream -
        Returns:
        Throws:
        java.io.IOException - If an I/O error occurs.
      • parseAttributes

        public java.util.List<Attribute> parseAttributes​(java.io.InputStream in,
                                                         int occurrenceCount)
                                                  throws java.io.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:
        java.io.IOException - If an I/O error occurs.
        Pack200Exception - TODO
      • parseLayout

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

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

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

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

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

        private java.lang.String readUpToMatchingBracket​(java.io.StringReader stream)
                                                  throws java.io.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:
        java.io.IOException - If an I/O error occurs.
      • resolveCalls

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

        public void setBackwardsCalls​(int[] backwardsCalls)
                               throws java.io.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:
        java.io.IOException - If an I/O error occurs.