Package kala.compress.harmony.pack200
Class NewAttributeBands
- java.lang.Object
-
- kala.compress.harmony.pack200.BandSet
-
- kala.compress.harmony.pack200.NewAttributeBands
-
public class NewAttributeBands extends BandSet
Sets of bands relating to a non-predefined attribute that has had a layout definition given to pack200 (e.g. via one of the -C, -M, -F or -D command line options)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceNewAttributeBands.AttributeLayoutElementAn AttributeLayoutElement is a part of an attribute layout and has one or more bands associated with it, which transmit the AttributeElement data for successive Attributes of this type.classNewAttributeBands.CallclassNewAttributeBands.CallableclassNewAttributeBands.IntegralclassNewAttributeBands.LayoutElementclassNewAttributeBands.ReferenceConstant Pool ReferenceclassNewAttributeBands.ReplicationA replication is an array of layout elements, with an associated countclassNewAttributeBands.UnionA Union is a type of layout element where the tag value acts as a selector for one of the union casesclassNewAttributeBands.UnionCaseA Union case-
Nested classes/interfaces inherited from class kala.compress.harmony.pack200.BandSet
BandSet.BandAnalysisResults, BandSet.BandData
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<NewAttributeBands.AttributeLayoutElement>attributeLayoutElementsprivate int[]backwardsCallCountsprivate CpBandscpBandsprivate AttributeDefinitionBands.AttributeDefinitiondefprivate NewAttributeBands.IntegrallastPIntegralprivate booleanusedAtLeastOnce-
Fields inherited from class kala.compress.harmony.pack200.BandSet
effort, segmentHeader
-
-
Constructor Summary
Constructors Constructor Description NewAttributeBands(int effort, CpBands cpBands, SegmentHeader header, AttributeDefinitionBands.AttributeDefinition def)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAttribute(NewAttribute attribute)java.lang.StringgetAttributeName()private BHSDCodecgetCodec(java.lang.String layoutElement)Returns theBHSDCodecthat should be used for the given layout elementintgetFlagIndex()private java.io.StringReadergetStreamUpToMatchingBracket(java.io.StringReader reader)Utility method to get the contents of the given stream, up to the next], (ignoring pairs of brackets[and])booleanisUsedAtLeastOnce()int[]numBackwardsCalls()voidpack(java.io.OutputStream outputStream)Write the packed set of bands to the given output streamprivate voidparseLayout()private java.util.List<NewAttributeBands.LayoutElement>readBody(java.io.StringReader reader)Read a 'body' section of the layout from the given streamprivate intreadInteger(int i, java.io.InputStream inputStream)private NewAttributeBands.AttributeLayoutElementreadNextAttributeElement(java.io.StringReader reader)private NewAttributeBands.LayoutElementreadNextLayoutElement(java.io.StringReader reader)private NewAttributeBands.UnionCasereadNextUnionCase(java.io.StringReader reader)Read a UnionCase from the streamprivate java.lang.IntegerreadNumber(java.io.StringReader stream)Read a number from the stream and return itprivate java.lang.StringreadUpToMatchingBracket(java.io.StringReader reader)Utility method to get the contents of the given stream, up to the next ']', (ignoring pairs of brackets '[' and ']')voidrenumberBci(IntList bciRenumbering, java.util.Map<org.objectweb.asm.Label,java.lang.Integer> labelsToOffsets)Renumber any bytecode indexes or offsets as described in section 5.5.2 of the pack200 specificationprivate voidresolveCalls()Resolve calls in the attribute layout and returns the number of backwards callablesprivate voidresolveCallsForElement(int i, NewAttributeBands.Callable currentCallable, NewAttributeBands.LayoutElement layoutElement)-
Methods inherited from class kala.compress.harmony.pack200.BandSet
cpEntryListToArray, cpEntryOrNullListToArray, encodeBandInt, encodeFlags, encodeFlags, encodeScalar, encodeScalar, integerListToArray, longListToArray
-
-
-
-
Field Detail
-
attributeLayoutElements
protected java.util.List<NewAttributeBands.AttributeLayoutElement> attributeLayoutElements
-
backwardsCallCounts
private int[] backwardsCallCounts
-
cpBands
private final CpBands cpBands
-
def
private final AttributeDefinitionBands.AttributeDefinition def
-
usedAtLeastOnce
private boolean usedAtLeastOnce
-
lastPIntegral
private NewAttributeBands.Integral lastPIntegral
-
-
Constructor Detail
-
NewAttributeBands
public NewAttributeBands(int effort, CpBands cpBands, SegmentHeader header, AttributeDefinitionBands.AttributeDefinition def) throws java.io.IOException- Throws:
java.io.IOException
-
-
Method Detail
-
addAttribute
public void addAttribute(NewAttribute attribute)
-
getAttributeName
public java.lang.String getAttributeName()
-
getCodec
private BHSDCodec getCodec(java.lang.String layoutElement)
Returns theBHSDCodecthat should be used for the given layout element- Parameters:
layoutElement-
-
getFlagIndex
public int getFlagIndex()
-
getStreamUpToMatchingBracket
private java.io.StringReader getStreamUpToMatchingBracket(java.io.StringReader reader) throws java.io.IOExceptionUtility method to get the contents of the given stream, up to the next], (ignoring pairs of brackets[and])- Parameters:
reader-- Returns:
- Throws:
java.io.IOException- If an I/O error occurs.
-
isUsedAtLeastOnce
public boolean isUsedAtLeastOnce()
-
numBackwardsCalls
public int[] numBackwardsCalls()
-
pack
public void pack(java.io.OutputStream outputStream) throws java.io.IOException, Pack200ExceptionDescription copied from class:BandSetWrite the packed set of bands to the given output stream- Specified by:
packin classBandSet- Parameters:
outputStream- TODO- Throws:
java.io.IOException- If an I/O error occurs.Pack200Exception- TODO
-
parseLayout
private void parseLayout() throws java.io.IOException- Throws:
java.io.IOException
-
readBody
private java.util.List<NewAttributeBands.LayoutElement> readBody(java.io.StringReader reader) throws java.io.IOException
Read a 'body' section of the layout from the given stream- Parameters:
reader-- Returns:
- List of LayoutElements
- Throws:
java.io.IOException- If an I/O error occurs.
-
readInteger
private int readInteger(int i, java.io.InputStream inputStream)
-
readNextAttributeElement
private NewAttributeBands.AttributeLayoutElement readNextAttributeElement(java.io.StringReader reader) throws java.io.IOException
- Throws:
java.io.IOException
-
readNextLayoutElement
private NewAttributeBands.LayoutElement readNextLayoutElement(java.io.StringReader reader) throws java.io.IOException
- Throws:
java.io.IOException
-
readNextUnionCase
private NewAttributeBands.UnionCase readNextUnionCase(java.io.StringReader reader) throws java.io.IOException
Read a UnionCase from the stream- Parameters:
reader-- Returns:
- Throws:
java.io.IOException- If an I/O error occurs.
-
readNumber
private java.lang.Integer readNumber(java.io.StringReader stream) throws java.io.IOExceptionRead 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 reader) throws java.io.IOExceptionUtility method to get the contents of the given stream, up to the next ']', (ignoring pairs of brackets '[' and ']')- Parameters:
reader-- Returns:
- Throws:
java.io.IOException- If an I/O error occurs.
-
renumberBci
public void renumberBci(IntList bciRenumbering, java.util.Map<org.objectweb.asm.Label,java.lang.Integer> labelsToOffsets)
Renumber any bytecode indexes or offsets as described in section 5.5.2 of the pack200 specification- Parameters:
bciRenumbering- TODOlabelsToOffsets- TODO
-
resolveCalls
private void resolveCalls()
Resolve calls in the attribute layout and returns the number of backwards callables
-
resolveCallsForElement
private void resolveCallsForElement(int i, NewAttributeBands.Callable currentCallable, NewAttributeBands.LayoutElement layoutElement)
-
-