Top Description Inners Fields Constructors Methods
org.apache.commons.compress.harmony.pack200

public Class NewAttribute

extends Attribute
Class Inheritance
Known Direct Subclasses
org.apache.commons.compress.harmony.pack200.NewAttribute.ErrorAttribute, org.apache.commons.compress.harmony.pack200.NewAttribute.PassAttribute, org.apache.commons.compress.harmony.pack200.NewAttribute.StripAttribute
Imports
org.objectweb.asm.Attribute, .ClassReader, .Label

NewAttribute extends Attribute and manages unknown attributes encountered by ASM that have had a layout definition given to pack200 (e.g. via one of the -C, -M, -F or -D command line options)

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
NewAttribute.ErrorAttribute

ErrorAttribute extends NewAttribute and manages attributes encountered by ASM that have had an error action specified to pack200 (e.g. via one of the -C, -M, -F or -D command line options such as -Cattribute-name=error)

public static class
NewAttribute.PassAttribute

PassAttribute extends NewAttribute and manages attributes encountered by ASM that have had a pass action specified to pack200 (e.g. via one of the -C, -M, -F or -D command line options such as -Cattribute-name=pass)

public static class
NewAttribute.StripAttribute

StripAttribute extends NewAttribute and manages attributes encountered by ASM that have had a strip action specified to pack200 (e.g. via one of the -C, -M, -F or -D command line options such as -Cattribute-name=strip)

Field Summary

Modifier and TypeField and Description
private char[]
private ClassReader
private int
private byte[]
private boolean
private boolean
private boolean
private boolean
private Label[]
private final String
Inherited from org.objectweb.asm.Attribute:
type

Constructor Summary

AccessConstructor and Description
public
NewAttribute(final ClassReader classReader, final String type, final String layout, final byte[] contents, final char[] buf, final int codeOff, final Label[] labels)

public
NewAttribute(final String type, final String layout, final int context)

Method Summary

Modifier and TypeMethod and Description
public void
addContext(final int context)

public byte[]
public Label
getLabel(final int index)

public String
public boolean
isCodeAttribute()

Overrides org.objectweb.asm.Attribute.isCodeAttribute.

Returns true if this type of attribute is a Code attribute.
public boolean
public boolean
public boolean
public boolean
public boolean
isUnknown()

Overrides org.objectweb.asm.Attribute.isUnknown.

Returns true if this type of attribute is unknown.
public boolean
isUnknown(final int context)

protected Attribute
read(final ClassReader
the class that contains the attribute to be read.
cr
,
final int
index of the first byte of the attribute's content in ClassReader. The 6 attribute header bytes (attribute_name_index and attribute_length) are not taken into account here.
off
,
final int
the length of the attribute's content (excluding the 6 attribute header bytes).
len
,
final char[]
the buffer to be used to call the ClassReader methods requiring a 'charBuffer' parameter.
buf
,
final int
index of the first byte of content of the enclosing Code attribute in ClassReader, or -1 if the attribute to be read is not a Code attribute. The 6 attribute header bytes (attribute_name_index and attribute_length) are not taken into account here.
codeOff
,
final Label[]
the labels of the method's code, or null if the attribute to be read is not a Code attribute.
labels
)

Overrides org.objectweb.asm.Attribute.read.

Reads a type attribute.
public String
readClass(final int index)

public Object
readConst(final int index)

public String
readUTF8(final int index)

Inherited from org.objectweb.asm.Attribute:
getLabelswrite

Field Detail

bufback to summary
private char[] buf
classReaderback to summary
private ClassReader classReader
codeOffback to summary
private int codeOff
contentsback to summary
private byte[] contents
contextClassback to summary
private boolean contextClass
contextCodeback to summary
private boolean contextCode
contextFieldback to summary
private boolean contextField
contextMethodback to summary
private boolean contextMethod
labelsback to summary
private Label[] labels
layoutback to summary
private final String layout

Constructor Detail

NewAttributeback to summary
public NewAttribute(final ClassReader classReader, final String type, final String layout, final byte[] contents, final char[] buf, final int codeOff, final Label[] labels)
NewAttributeback to summary
public NewAttribute(final String type, final String layout, final int context)

Method Detail

addContextback to summary
public void addContext(final int context)
getBytesback to summary
public byte[] getBytes()
getLabelback to summary
public Label getLabel(final int index)
getLayoutback to summary
public String getLayout()
isCodeAttributeback to summary
public boolean isCodeAttribute()

Overrides org.objectweb.asm.Attribute.isCodeAttribute.

Doc from org.objectweb.asm.Attribute.isCodeAttribute.

Returns true if this type of attribute is a Code attribute.

Returns:boolean

true if this type of attribute is a Code attribute.

Annotations
@Override
isContextClassback to summary
public boolean isContextClass()
isContextCodeback to summary
public boolean isContextCode()
isContextFieldback to summary
public boolean isContextField()
isContextMethodback to summary
public boolean isContextMethod()
isUnknownback to summary
public boolean isUnknown()

Overrides org.objectweb.asm.Attribute.isUnknown.

Doc from org.objectweb.asm.Attribute.isUnknown.

Returns true if this type of attribute is unknown. This means that the attribute content can't be parsed to extract constant pool references, labels, etc. Instead, the attribute content is read as an opaque byte array, and written back as is. This can lead to invalid attributes, if the content actually contains constant pool references, labels, or other symbolic references that need to be updated when there are changes to the constant pool, the method bytecode, etc. The default implementation of this method always returns true.

Returns:boolean

true if this type of attribute is unknown.

Annotations
@Override
isUnknownback to summary
public boolean isUnknown(final int context)
readback to summary
protected Attribute read(final ClassReader cr, final int off, final int len, final char[] buf, final int codeOff, final Label[] labels)

Overrides org.objectweb.asm.Attribute.read.

Doc from org.objectweb.asm.Attribute.read.

Reads a type attribute. This method must return a new Attribute object, of type type, corresponding to the 'length' bytes starting at 'offset', in the given ClassReader.

Parameters
cr:ClassReader

the class that contains the attribute to be read.

off:int

index of the first byte of the attribute's content in ClassReader. The 6 attribute header bytes (attribute_name_index and attribute_length) are not taken into account here.

len:int

the length of the attribute's content (excluding the 6 attribute header bytes).

buf:char[]

the buffer to be used to call the ClassReader methods requiring a 'charBuffer' parameter.

codeOff:int

index of the first byte of content of the enclosing Code attribute in ClassReader, or -1 if the attribute to be read is not a Code attribute. The 6 attribute header bytes (attribute_name_index and attribute_length) are not taken into account here.

labels:Label[]

the labels of the method's code, or null if the attribute to be read is not a Code attribute.

Returns:Attribute

a new Attribute object corresponding to the specified bytes.

Annotations
@Override
readClassback to summary
public String readClass(final int index)
readConstback to summary
public Object readConst(final int index)
readUTF8back to summary
public String readUTF8(final int index)
org.apache.commons.compress.harmony.pack200 back to summary

public Class NewAttribute.ErrorAttribute

extends NewAttribute
Class Inheritance

ErrorAttribute extends NewAttribute and manages attributes encountered by ASM that have had an error action specified to pack200 (e.g. via one of the -C, -M, -F or -D command line options such as -Cattribute-name=error)

Constructor Summary

AccessConstructor and Description
public
ErrorAttribute(final String type, final int context)

Method Summary

Modifier and TypeMethod and Description
protected Attribute
read(final ClassReader
the class that contains the attribute to be read.
cr
,
final int
index of the first byte of the attribute's content in ClassReader. The 6 attribute header bytes (attribute_name_index and attribute_length) are not taken into account here.
off
,
final int
the length of the attribute's content (excluding the 6 attribute header bytes).
len
,
final char[]
the buffer to be used to call the ClassReader methods requiring a 'charBuffer' parameter.
buf
,
final int
index of the first byte of content of the enclosing Code attribute in ClassReader, or -1 if the attribute to be read is not a Code attribute. The 6 attribute header bytes (attribute_name_index and attribute_length) are not taken into account here.
codeOff
,
final Label[]
the labels of the method's code, or null if the attribute to be read is not a Code attribute.
labels
)

Overrides org.apache.commons.compress.harmony.pack200.NewAttribute.read.

Reads a type attribute.
Inherited from org.apache.commons.compress.harmony.pack200.NewAttribute:
addContextgetBytesgetLabelgetLayoutisCodeAttributeisContextClassisContextCodeisContextFieldisContextMethodisUnknownisUnknownreadClassreadConstreadUTF8

Constructor Detail

ErrorAttributeback to summary
public ErrorAttribute(final String type, final int context)

Method Detail

readback to summary
protected Attribute read(final ClassReader cr, final int off, final int len, final char[] buf, final int codeOff, final Label[] labels)

Overrides org.apache.commons.compress.harmony.pack200.NewAttribute.read.

Doc from org.objectweb.asm.Attribute.read.

Reads a type attribute. This method must return a new Attribute object, of type type, corresponding to the 'length' bytes starting at 'offset', in the given ClassReader.

Parameters
cr:ClassReader

the class that contains the attribute to be read.

off:int

index of the first byte of the attribute's content in ClassReader. The 6 attribute header bytes (attribute_name_index and attribute_length) are not taken into account here.

len:int

the length of the attribute's content (excluding the 6 attribute header bytes).

buf:char[]

the buffer to be used to call the ClassReader methods requiring a 'charBuffer' parameter.

codeOff:int

index of the first byte of content of the enclosing Code attribute in ClassReader, or -1 if the attribute to be read is not a Code attribute. The 6 attribute header bytes (attribute_name_index and attribute_length) are not taken into account here.

labels:Label[]

the labels of the method's code, or null if the attribute to be read is not a Code attribute.

Returns:Attribute

a new Attribute object corresponding to the specified bytes.

Annotations
@Override
org.apache.commons.compress.harmony.pack200 back to summary

public Class NewAttribute.PassAttribute

extends NewAttribute
Class Inheritance

PassAttribute extends NewAttribute and manages attributes encountered by ASM that have had a pass action specified to pack200 (e.g. via one of the -C, -M, -F or -D command line options such as -Cattribute-name=pass)

Constructor Summary

AccessConstructor and Description
public
PassAttribute(final String type, final int context)

Method Summary

Modifier and TypeMethod and Description
protected Attribute
read(final ClassReader
the class that contains the attribute to be read.
cr
,
final int
index of the first byte of the attribute's content in ClassReader. The 6 attribute header bytes (attribute_name_index and attribute_length) are not taken into account here.
off
,
final int
the length of the attribute's content (excluding the 6 attribute header bytes).
len
,
final char[]
the buffer to be used to call the ClassReader methods requiring a 'charBuffer' parameter.
buf
,
final int
index of the first byte of content of the enclosing Code attribute in ClassReader, or -1 if the attribute to be read is not a Code attribute. The 6 attribute header bytes (attribute_name_index and attribute_length) are not taken into account here.
codeOff
,
final Label[]
the labels of the method's code, or null if the attribute to be read is not a Code attribute.
labels
)

Overrides org.apache.commons.compress.harmony.pack200.NewAttribute.read.

Reads a type attribute.
Inherited from org.apache.commons.compress.harmony.pack200.NewAttribute:
addContextgetBytesgetLabelgetLayoutisCodeAttributeisContextClassisContextCodeisContextFieldisContextMethodisUnknownisUnknownreadClassreadConstreadUTF8

Constructor Detail

PassAttributeback to summary
public PassAttribute(final String type, final int context)

Method Detail

readback to summary
protected Attribute read(final ClassReader cr, final int off, final int len, final char[] buf, final int codeOff, final Label[] labels)

Overrides org.apache.commons.compress.harmony.pack200.NewAttribute.read.

Doc from org.objectweb.asm.Attribute.read.

Reads a type attribute. This method must return a new Attribute object, of type type, corresponding to the 'length' bytes starting at 'offset', in the given ClassReader.

Parameters
cr:ClassReader

the class that contains the attribute to be read.

off:int

index of the first byte of the attribute's content in ClassReader. The 6 attribute header bytes (attribute_name_index and attribute_length) are not taken into account here.

len:int

the length of the attribute's content (excluding the 6 attribute header bytes).

buf:char[]

the buffer to be used to call the ClassReader methods requiring a 'charBuffer' parameter.

codeOff:int

index of the first byte of content of the enclosing Code attribute in ClassReader, or -1 if the attribute to be read is not a Code attribute. The 6 attribute header bytes (attribute_name_index and attribute_length) are not taken into account here.

labels:Label[]

the labels of the method's code, or null if the attribute to be read is not a Code attribute.

Returns:Attribute

a new Attribute object corresponding to the specified bytes.

Annotations
@Override
org.apache.commons.compress.harmony.pack200 back to summary

public Class NewAttribute.StripAttribute

extends NewAttribute
Class Inheritance

StripAttribute extends NewAttribute and manages attributes encountered by ASM that have had a strip action specified to pack200 (e.g. via one of the -C, -M, -F or -D command line options such as -Cattribute-name=strip)

Constructor Summary

AccessConstructor and Description
public
StripAttribute(final String type, final int context)

Method Summary

Modifier and TypeMethod and Description
protected Attribute
read(final ClassReader
the class that contains the attribute to be read.
cr
,
final int
index of the first byte of the attribute's content in ClassReader. The 6 attribute header bytes (attribute_name_index and attribute_length) are not taken into account here.
off
,
final int
the length of the attribute's content (excluding the 6 attribute header bytes).
len
,
final char[]
the buffer to be used to call the ClassReader methods requiring a 'charBuffer' parameter.
buf
,
final int
index of the first byte of content of the enclosing Code attribute in ClassReader, or -1 if the attribute to be read is not a Code attribute. The 6 attribute header bytes (attribute_name_index and attribute_length) are not taken into account here.
codeOff
,
final Label[]
the labels of the method's code, or null if the attribute to be read is not a Code attribute.
labels
)

Overrides org.apache.commons.compress.harmony.pack200.NewAttribute.read.

Reads a type attribute.
Inherited from org.apache.commons.compress.harmony.pack200.NewAttribute:
addContextgetBytesgetLabelgetLayoutisCodeAttributeisContextClassisContextCodeisContextFieldisContextMethodisUnknownisUnknownreadClassreadConstreadUTF8

Constructor Detail

StripAttributeback to summary
public StripAttribute(final String type, final int context)

Method Detail

readback to summary
protected Attribute read(final ClassReader cr, final int off, final int len, final char[] buf, final int codeOff, final Label[] labels)

Overrides org.apache.commons.compress.harmony.pack200.NewAttribute.read.

Doc from org.objectweb.asm.Attribute.read.

Reads a type attribute. This method must return a new Attribute object, of type type, corresponding to the 'length' bytes starting at 'offset', in the given ClassReader.

Parameters
cr:ClassReader

the class that contains the attribute to be read.

off:int

index of the first byte of the attribute's content in ClassReader. The 6 attribute header bytes (attribute_name_index and attribute_length) are not taken into account here.

len:int

the length of the attribute's content (excluding the 6 attribute header bytes).

buf:char[]

the buffer to be used to call the ClassReader methods requiring a 'charBuffer' parameter.

codeOff:int

index of the first byte of content of the enclosing Code attribute in ClassReader, or -1 if the attribute to be read is not a Code attribute. The 6 attribute header bytes (attribute_name_index and attribute_length) are not taken into account here.

labels:Label[]

the labels of the method's code, or null if the attribute to be read is not a Code attribute.

Returns:Attribute

a new Attribute object corresponding to the specified bytes.

Annotations
@Override