📄 attributeinfo.java
字号:
public static final int SAME_LOCALS_1_STACK_ITEM_EXTENDED = 247;
public static final int CHOP_L = 248;
public static final int CHOP_H = 250;
public static final int SAME_FRAME_EXTENDED = 251;
public static final int APPEND_L = 252;
public static final int APPEND_H = 254;
public static final int FULL_FRAME = 255;
abstract void write(DataOutputStream out) throws IOException;
static StackMapFrame construct(DataInputStream in) throws IOException
{
int tag = in.readUnsignedByte();
if ((tag >= SAME_L) && (tag <= SAME_H))
return new SameFrame(in, tag);
else if ((tag >= SAME_LOCALS_1_STACK_ITEM_L) && (tag <= SAME_LOCALS_1_STACK_ITEM_H))
return new SameLocals1StackItemFrame(in, tag);
else if (tag == SAME_LOCALS_1_STACK_ITEM_EXTENDED)
return new SameLocals1StackItemFrameExtended(in, tag);
else if ((tag >= CHOP_L) && (tag <= CHOP_H))
return new ChopFrame(in, tag);
else if (tag == SAME_FRAME_EXTENDED)
return new SameFrameExtended(in, tag);
else if ((tag >= APPEND_L) && (tag <= APPEND_H))
return new AppendFrame(in, tag);
else if (tag == FULL_FRAME)
return new FullFrame(in, tag);
else
return null;
}
public int getFrameType() { return frameType; }
public static class SameFrame extends StackMapFrame
{
SameFrame(DataInputStream in, int tag) throws IOException
{
frameType = tag;
}
void write(DataOutputStream out) throws IOException
{
out.writeByte(frameType);
}
}
public static class SameLocals1StackItemFrame extends StackMapFrame
{
private VerificationTypeInfo[] stack;
SameLocals1StackItemFrame(DataInputStream in, int tag) throws IOException
{
frameType = tag;
stack = new VerificationTypeInfo[1];
stack[0] = VerificationTypeInfo.construct(in);
}
void write(DataOutputStream out) throws IOException
{
out.writeByte(frameType);
stack[0].write(out);
}
}
public static class SameLocals1StackItemFrameExtended extends StackMapFrame
{
private int offsetDelta;
private VerificationTypeInfo[] stack;
SameLocals1StackItemFrameExtended(DataInputStream in, int tag) throws IOException
{
frameType = tag;
offsetDelta = in.readUnsignedShort();
stack = new VerificationTypeInfo[1];
stack[0] = VerificationTypeInfo.construct(in);
}
void write(DataOutputStream out) throws IOException
{
out.writeByte(frameType);
out.writeShort(offsetDelta);
stack[0].write(out);
}
}
public static class ChopFrame extends StackMapFrame
{
private int offsetDelta;
ChopFrame(DataInputStream in, int tag) throws IOException
{
frameType = tag;
offsetDelta = in.readUnsignedShort();
}
void write(DataOutputStream out) throws IOException
{
out.writeByte(frameType);
out.writeShort(offsetDelta);
}
}
public static class SameFrameExtended extends ChopFrame
{
SameFrameExtended(DataInputStream in, int tag) throws IOException { super(in, tag); }
}
public static class AppendFrame extends StackMapFrame
{
private int offsetDelta;
private VerificationTypeInfo[] locals;
AppendFrame(DataInputStream in, int tag) throws IOException
{
frameType = tag;
offsetDelta = in.readUnsignedShort();
locals = new VerificationTypeInfo[frameType - 251];
for(int i = 0; i < locals.length; i++)
locals[i] = VerificationTypeInfo.construct(in);
}
void write(DataOutputStream out) throws IOException
{
out.writeByte(frameType);
out.writeShort(offsetDelta);
for(int i = 0; i < locals.length; i++)
locals[i].write(out);
}
}
public static class FullFrame extends StackMapFrame
{
private int offsetDelta;
private int numberOfLocals;
private VerificationTypeInfo[] locals;
private int numberOfStackItems;
private VerificationTypeInfo[] stack;
FullFrame(DataInputStream in, int tag) throws IOException
{
frameType = tag;
offsetDelta = in.readUnsignedShort();
numberOfLocals = in.readUnsignedShort();
locals = new VerificationTypeInfo[numberOfLocals];
for(int i = 0; i < numberOfLocals; i++)
locals[i] = VerificationTypeInfo.construct(in);
numberOfStackItems = in.readUnsignedShort();
stack = new VerificationTypeInfo[numberOfStackItems];
for(int i = 0; i < numberOfStackItems; i++)
stack[i] = VerificationTypeInfo.construct(in);
}
void write(DataOutputStream out) throws IOException
{
out.writeByte(frameType);
out.writeShort(offsetDelta);
out.writeShort(numberOfLocals);
for(int i = 0; i < numberOfLocals; i++)
locals[i].write(out);
out.writeShort(numberOfStackItems);
for(int i = 0; i < numberOfStackItems; i++)
stack[i].write(out);
}
}
public abstract static class VerificationTypeInfo
{
protected int tag;
public static final int TOP = 0;
public static final int INTEGER = 1;
public static final int FLOAT = 2;
public static final int LONG = 4;
public static final int DOUBLE = 3;
public static final int NULL = 5;
public static final int UNINITIALIZEDTHIS = 6;
public static final int OBJECT = 7;
public static final int UNINITIALIZED = 8;
static VerificationTypeInfo construct (DataInputStream in) throws IOException
{
int tag = in.readUnsignedByte();
switch (tag)
{
case TOP:
return new TopVariableInfo(tag);
case INTEGER:
return new IntegerVariableInfo(tag);
case FLOAT:
return new FloatVariableInfo(tag);
case LONG:
return new LongVariableInfo(tag);
case DOUBLE:
return new DoubleVariableInfo(tag);
case NULL:
return new NullVariableInfo(tag);
case UNINITIALIZEDTHIS:
return new UninitializedThisVariableInfo(tag);
case OBJECT:
return new ObjectVariableInfo(in, tag);
case UNINITIALIZED:
return new UninitializedVariableInfo(in, tag);
}
return null;
}
public int getTag() { return tag; }
public void write(DataOutputStream out) throws IOException { out.writeByte(tag); }
public static class TopVariableInfo extends VerificationTypeInfo
{
TopVariableInfo(int tag) throws IOException { this.tag = tag; }
}
public static class IntegerVariableInfo extends TopVariableInfo
{
IntegerVariableInfo(int tag) throws IOException { super(tag); }
}
public static class FloatVariableInfo extends TopVariableInfo
{
FloatVariableInfo(int tag) throws IOException { super(tag); }
}
public static class LongVariableInfo extends TopVariableInfo
{
LongVariableInfo(int tag) throws IOException { super(tag); }
}
public static class DoubleVariableInfo extends TopVariableInfo
{
DoubleVariableInfo(int tag) throws IOException { super(tag); }
}
public static class NullVariableInfo extends TopVariableInfo
{
NullVariableInfo(int tag) throws IOException { super(tag); }
}
public static class UninitializedThisVariableInfo extends TopVariableInfo
{
UninitializedThisVariableInfo(int tag) throws IOException { super(tag); }
}
public static class ObjectVariableInfo extends VerificationTypeInfo
{
private int cpoolIndex;
ObjectVariableInfo(DataInputStream in, int tag) throws IOException
{
this.tag = tag;
cpoolIndex = in.readUnsignedShort();
}
public void write(DataOutputStream out) throws IOException
{
out.writeByte(tag);
out.writeShort(cpoolIndex);
}
}
public static class UninitializedVariableInfo extends VerificationTypeInfo
{
private int offset;
UninitializedVariableInfo(DataInputStream in, int tag) throws IOException
{
this.tag = tag;
offset = in.readUnsignedShort();
}
public void write(DataOutputStream out) throws IOException
{
out.writeByte(tag);
out.writeShort(offset);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -