C# 클래스 Org.Mozilla.Classfile.ClassFileWriter

ClassFileWriter A ClassFileWriter is used to write a Java class file.
ClassFileWriter A ClassFileWriter is used to write a Java class file. Methods are provided to create fields and methods, and within methods to write Java bytecodes.
파일 보기 프로젝트 열기: hazzik/Rhino.Net 1 사용 예제들

공개 메소드들

메소드 설명
AcquireLabel ( ) : int
Add ( int theOpCode ) : void

Add the single-byte opcode to the current method.

Add the single-byte opcode to the current method.

Add ( int theOpCode, int theOperand ) : void

Add a single-operand opcode to the current method.

Add a single-operand opcode to the current method.

Add ( int theOpCode, int theOperand1, int theOperand2 ) : void

Add the given two-operand bytecode to the current method.

Add the given two-operand bytecode to the current method.

Add ( int theOpCode, string className ) : void
Add ( int theOpCode, string className, string fieldName, string fieldType ) : void
AddALoad ( int local ) : void

Load object from the given local into stack.

Load object from the given local into stack.

AddAStore ( int local ) : void

Store object from stack top into the given local.

Store object from stack top into the given local.

AddDLoad ( int local ) : void

Load double from the given local into stack.

Load double from the given local into stack.

AddDStore ( int local ) : void

Store double from stack top into the given local.

Store double from stack top into the given local.

AddExceptionHandler ( int startLabel, int endLabel, int handlerLabel, string catchClassName ) : void
AddFLoad ( int local ) : void

Load float from the given local into stack.

Load float from the given local into stack.

AddFStore ( int local ) : void

Store float from stack top into the given local.

Store float from stack top into the given local.

AddField ( string fieldName, string type, short flags ) : void

Add a field to the class.

Add a field to the class.

AddField ( string fieldName, string type, short flags, double value ) : void

Add a field to the class.

Add a field to the class.

AddField ( string fieldName, string type, short flags, int value ) : void

Add a field to the class.

Add a field to the class.

AddField ( string fieldName, string type, short flags, long value ) : void

Add a field to the class.

Add a field to the class.

AddILoad ( int local ) : void

Load integer from the given local into stack.

Load integer from the given local into stack.

AddIStore ( int local ) : void

Store integer from stack top into the given local.

Store integer from stack top into the given local.

AddInterface ( string interfaceName ) : void

Add an interface implemented by this class.

Add an interface implemented by this class. This method may be called multiple times for classes that implement multiple interfaces.

AddInvoke ( int theOpCode, string className, string methodName, string methodType ) : void
AddLLoad ( int local ) : void

Load long from the given local into stack.

Load long from the given local into stack.

AddLStore ( int local ) : void

Store long from stack top into the given local.

Store long from stack top into the given local.

AddLineNumberEntry ( short lineNumber ) : void
AddLoadConstant ( double k ) : void

Generate the load constant bytecode for the given double.

Generate the load constant bytecode for the given double.

AddLoadConstant ( float k ) : void

Generate the load constant bytecode for the given float.

Generate the load constant bytecode for the given float.

AddLoadConstant ( int k ) : void

Generate the load constant bytecode for the given integer.

Generate the load constant bytecode for the given integer.

AddLoadConstant ( long k ) : void

Generate the load constant bytecode for the given long.

Generate the load constant bytecode for the given long.

AddLoadConstant ( string k ) : void

Generate the load constant bytecode for the given string.

Generate the load constant bytecode for the given string.

AddLoadThis ( ) : void

Load "this" into stack.

Load "this" into stack.

AddPush ( bool k ) : void
AddPush ( double k ) : void

Generate code to load the given double on stack.

Generate code to load the given double on stack.

AddPush ( int k ) : void

Generate code to load the given integer on stack.

Generate code to load the given integer on stack.

AddPush ( long k ) : void

Generate code to load the given long on stack.

Generate code to load the given long on stack.

AddPush ( string k ) : void

Generate the code to leave on stack the given string even if the string encoding exeeds the class file limit for single string constant

AddTableSwitch ( int low, int high ) : int
AddVariableDescriptor ( string name, string type, int startPC, int register ) : void

Add Information about java variable to use when generating the local variable table.

Add Information about java variable to use when generating the local variable table.

AdjustStackTop ( int delta ) : void
ClassFileWriter ( string className, string superClassName, string sourceFileName ) : System

Construct a ClassFileWriter for a class.

Construct a ClassFileWriter for a class.

ClassNameToSignature ( string name ) : string

Convert Java class name in dot notation into "Lname-with-dots-replaced-by-slashes;" form suitable for use as JVM type signatures.

Convert Java class name in dot notation into "Lname-with-dots-replaced-by-slashes;" form suitable for use as JVM type signatures.

GetClassName ( ) : string
GetCurrentCodeOffset ( ) : int

Get the current offset into the code of the current method.

Get the current offset into the code of the current method.

GetLabelPC ( int label ) : int
GetStackTop ( ) : short
IsUnderStringSizeLimit ( string k ) : bool

Check if k fits limit on string constant size imposed by class file format.

Check if k fits limit on string constant size imposed by class file format.

MarkHandler ( int theLabel ) : void
MarkLabel ( int label ) : void
MarkLabel ( int label, short stackTop ) : void
MarkTableSwitchCase ( int switchStart, int caseIndex ) : void
MarkTableSwitchCase ( int switchStart, int caseIndex, int stackTop ) : void
MarkTableSwitchDefault ( int switchStart ) : void
SetFlags ( short flags ) : void

Set the class's flags.

Set the class's flags. Flags must be a set of the following flags, bitwise or'd together: ACC_PUBLIC ACC_PRIVATE ACC_PROTECTED ACC_FINAL ACC_ABSTRACT TODO: check that this is the appropriate set

SetStackTop ( short n ) : void
SetTableSwitchJump ( int switchStart, int caseIndex, int jumpTarget ) : void

Set a jump case for a tableswitch instruction.

Set a jump case for a tableswitch instruction. The jump target should be marked as a super block start for stack map generation.

StartMethod ( string methodName, string type, short flags ) : void

Add a method and begin adding code.

Add a method and begin adding code. This method must be called before other methods for adding code, exception tables, etc. can be invoked.

StopMethod ( short maxLocals ) : void

Complete generation of the method.

Complete generation of the method. After this method is called, no more code can be added to the method begun with startMethod.

ToByteArray ( ) : byte[]

Get the class file as array of bytesto the OutputStream.

Get the class file as array of bytesto the OutputStream.

Write ( Stream oStream ) : void

Write the class file to the OutputStream.

Write the class file to the OutputStream.

비공개 메소드들

메소드 설명
AddLabelFixup ( int label, int fixupSite ) : void
AddReservedCodeSpace ( int size ) : int
AddSuperBlockStart ( int pc ) : void

Add a pc as the start of super block.

Add a pc as the start of super block. A pc is the beginning of a super block if: - pc == 0 - it is the target of a branch instruction - it is the beginning of an exception handler - it is directly after an unconditional jump

AddToCodeBuffer ( int b ) : void
AddToCodeInt16 ( int value ) : void
ArrayTypeToName ( int type ) : char

Convert a newarray operand into an internal type.

Convert a newarray operand into an internal type.

BadStack ( int value ) : void
BytecodeStr ( int code ) : string
ClassDescriptorToInternalName ( string descriptor ) : string

Convert a class descriptor into an internal name.

Convert a class descriptor into an internal name. For example, descriptor Ljava/lang/Object; becomes java/lang/Object.

ClassFileWriter ( ) : System
CreateInitialLocals ( ) : int[]

Compute the initial local variable array for the current method.

Compute the initial local variable array for the current method. Creates an array of the size of the method's max locals, regardless of the number of parameters in the method.

DescriptorToInternalName ( string descriptor ) : string

Convert a non-method type descriptor into an internal type.

Convert a non-method type descriptor into an internal type.

FinalizeSuperBlockStarts ( ) : void

Sort the list of recorded super block starts and remove duplicates.

Sort the list of recorded super block starts and remove duplicates. Also adds exception handling blocks as block starts, since there is no explicit control flow to these. Used for stack map table generation.

FixLabelGotos ( ) : void
GetCharBuffer ( int minimalSize ) : char[]
GetSlashedForm ( string name ) : string
GetWriteSize ( ) : int
OpcodeCount ( int opcode ) : int

Number of operands accompanying the opcode.

Number of operands accompanying the opcode.

OpcodeLength ( int opcode, bool wide ) : int

Size of a bytecode instruction, counting the opcode and its operands.

Size of a bytecode instruction, counting the opcode and its operands. This is different from opcodeCount, since opcodeCount counts logical operands.

PutInt16 ( int value, byte array, int offset ) : int
PutInt32 ( int value, byte array, int offset ) : int
PutInt64 ( long value, byte array, int offset ) : int
SizeOfParameters ( string pString ) : int
StackChange ( int opcode ) : int

The effect on the operand stack of a given opcode.

The effect on the operand stack of a given opcode.

Xop ( int shortOp, int op, int local ) : void

메소드 상세

AcquireLabel() 공개 메소드

public AcquireLabel ( ) : int
리턴 int

Add() 공개 메소드

Add the single-byte opcode to the current method.
Add the single-byte opcode to the current method.
public Add ( int theOpCode ) : void
theOpCode int the opcode of the bytecode
리턴 void

Add() 공개 메소드

Add a single-operand opcode to the current method.
Add a single-operand opcode to the current method.
public Add ( int theOpCode, int theOperand ) : void
theOpCode int the opcode of the bytecode
theOperand int the operand of the bytecode
리턴 void

Add() 공개 메소드

Add the given two-operand bytecode to the current method.
Add the given two-operand bytecode to the current method.
public Add ( int theOpCode, int theOperand1, int theOperand2 ) : void
theOpCode int the opcode of the bytecode
theOperand1 int the first operand of the bytecode
theOperand2 int the second operand of the bytecode
리턴 void

Add() 공개 메소드

public Add ( int theOpCode, string className ) : void
theOpCode int
className string
리턴 void

Add() 공개 메소드

public Add ( int theOpCode, string className, string fieldName, string fieldType ) : void
theOpCode int
className string
fieldName string
fieldType string
리턴 void

AddALoad() 공개 메소드

Load object from the given local into stack.
Load object from the given local into stack.
public AddALoad ( int local ) : void
local int number of local register
리턴 void

AddAStore() 공개 메소드

Store object from stack top into the given local.
Store object from stack top into the given local.
public AddAStore ( int local ) : void
local int number of local register
리턴 void

AddDLoad() 공개 메소드

Load double from the given local into stack.
Load double from the given local into stack.
public AddDLoad ( int local ) : void
local int number of local register
리턴 void

AddDStore() 공개 메소드

Store double from stack top into the given local.
Store double from stack top into the given local.
public AddDStore ( int local ) : void
local int number of local register
리턴 void

AddExceptionHandler() 공개 메소드

public AddExceptionHandler ( int startLabel, int endLabel, int handlerLabel, string catchClassName ) : void
startLabel int
endLabel int
handlerLabel int
catchClassName string
리턴 void

AddFLoad() 공개 메소드

Load float from the given local into stack.
Load float from the given local into stack.
public AddFLoad ( int local ) : void
local int number of local register
리턴 void

AddFStore() 공개 메소드

Store float from stack top into the given local.
Store float from stack top into the given local.
public AddFStore ( int local ) : void
local int number of local register
리턴 void

AddField() 공개 메소드

Add a field to the class.
Add a field to the class.
public AddField ( string fieldName, string type, short flags ) : void
fieldName string the name of the field
type string the type of the field using ...
flags short /// the attributes of the field, such as ACC_PUBLIC, etc. /// bitwise or'd together ///
리턴 void

AddField() 공개 메소드

Add a field to the class.
Add a field to the class.
public AddField ( string fieldName, string type, short flags, double value ) : void
fieldName string the name of the field
type string the type of the field using ...
flags short /// the attributes of the field, such as ACC_PUBLIC, etc. /// bitwise or'd together ///
value double an initial double value
리턴 void

AddField() 공개 메소드

Add a field to the class.
Add a field to the class.
public AddField ( string fieldName, string type, short flags, int value ) : void
fieldName string the name of the field
type string the type of the field using ...
flags short /// the attributes of the field, such as ACC_PUBLIC, etc. /// bitwise or'd together ///
value int an initial integral value
리턴 void

AddField() 공개 메소드

Add a field to the class.
Add a field to the class.
public AddField ( string fieldName, string type, short flags, long value ) : void
fieldName string the name of the field
type string the type of the field using ...
flags short /// the attributes of the field, such as ACC_PUBLIC, etc. /// bitwise or'd together ///
value long an initial long value
리턴 void

AddILoad() 공개 메소드

Load integer from the given local into stack.
Load integer from the given local into stack.
public AddILoad ( int local ) : void
local int number of local register
리턴 void

AddIStore() 공개 메소드

Store integer from stack top into the given local.
Store integer from stack top into the given local.
public AddIStore ( int local ) : void
local int number of local register
리턴 void

AddInterface() 공개 메소드

Add an interface implemented by this class.
Add an interface implemented by this class. This method may be called multiple times for classes that implement multiple interfaces.
public AddInterface ( string interfaceName ) : void
interfaceName string /// a name of an interface implemented /// by the class being written, including full package /// qualification. ///
리턴 void

AddInvoke() 공개 메소드

public AddInvoke ( int theOpCode, string className, string methodName, string methodType ) : void
theOpCode int
className string
methodName string
methodType string
리턴 void

AddLLoad() 공개 메소드

Load long from the given local into stack.
Load long from the given local into stack.
public AddLLoad ( int local ) : void
local int number of local register
리턴 void

AddLStore() 공개 메소드

Store long from stack top into the given local.
Store long from stack top into the given local.
public AddLStore ( int local ) : void
local int number of local register
리턴 void

AddLineNumberEntry() 공개 메소드

public AddLineNumberEntry ( short lineNumber ) : void
lineNumber short
리턴 void

AddLoadConstant() 공개 메소드

Generate the load constant bytecode for the given double.
Generate the load constant bytecode for the given double.
public AddLoadConstant ( double k ) : void
k double the constant
리턴 void

AddLoadConstant() 공개 메소드

Generate the load constant bytecode for the given float.
Generate the load constant bytecode for the given float.
public AddLoadConstant ( float k ) : void
k float the constant
리턴 void

AddLoadConstant() 공개 메소드

Generate the load constant bytecode for the given integer.
Generate the load constant bytecode for the given integer.
public AddLoadConstant ( int k ) : void
k int the constant
리턴 void

AddLoadConstant() 공개 메소드

Generate the load constant bytecode for the given long.
Generate the load constant bytecode for the given long.
public AddLoadConstant ( long k ) : void
k long the constant
리턴 void

AddLoadConstant() 공개 메소드

Generate the load constant bytecode for the given string.
Generate the load constant bytecode for the given string.
public AddLoadConstant ( string k ) : void
k string the constant
리턴 void

AddLoadThis() 공개 메소드

Load "this" into stack.
Load "this" into stack.
public AddLoadThis ( ) : void
리턴 void

AddPush() 공개 메소드

public AddPush ( bool k ) : void
k bool
리턴 void

AddPush() 공개 메소드

Generate code to load the given double on stack.
Generate code to load the given double on stack.
public AddPush ( double k ) : void
k double the constant
리턴 void

AddPush() 공개 메소드

Generate code to load the given integer on stack.
Generate code to load the given integer on stack.
public AddPush ( int k ) : void
k int the constant
리턴 void

AddPush() 공개 메소드

Generate code to load the given long on stack.
Generate code to load the given long on stack.
public AddPush ( long k ) : void
k long the constant
리턴 void

AddPush() 공개 메소드

Generate the code to leave on stack the given string even if the string encoding exeeds the class file limit for single string constant
public AddPush ( string k ) : void
k string the constant
리턴 void

AddTableSwitch() 공개 메소드

public AddTableSwitch ( int low, int high ) : int
low int
high int
리턴 int

AddVariableDescriptor() 공개 메소드

Add Information about java variable to use when generating the local variable table.
Add Information about java variable to use when generating the local variable table.
public AddVariableDescriptor ( string name, string type, int startPC, int register ) : void
name string variable name.
type string variable type as bytecode descriptor string.
startPC int /// the starting bytecode PC where this variable is live, /// or -1 if it does not have a Java register. ///
register int /// the Java register number of variable /// or -1 if it does not have a Java register. ///
리턴 void

AdjustStackTop() 공개 메소드

public AdjustStackTop ( int delta ) : void
delta int
리턴 void

ClassFileWriter() 공개 메소드

Construct a ClassFileWriter for a class.
Construct a ClassFileWriter for a class.
public ClassFileWriter ( string className, string superClassName, string sourceFileName ) : System
className string /// the name of the class to write, including /// full package qualification. ///
superClassName string /// the name of the superclass of the class /// to write, including full package qualification. ///
sourceFileName string /// the name of the source file to use for /// producing debug information, or null if debug information /// is not desired ///
리턴 System

ClassNameToSignature() 공개 정적인 메소드

Convert Java class name in dot notation into "Lname-with-dots-replaced-by-slashes;" form suitable for use as JVM type signatures.
Convert Java class name in dot notation into "Lname-with-dots-replaced-by-slashes;" form suitable for use as JVM type signatures.
public static ClassNameToSignature ( string name ) : string
name string
리턴 string

GetClassName() 공개 메소드

public GetClassName ( ) : string
리턴 string

GetCurrentCodeOffset() 공개 메소드

Get the current offset into the code of the current method.
Get the current offset into the code of the current method.
public GetCurrentCodeOffset ( ) : int
리턴 int

GetLabelPC() 공개 메소드

public GetLabelPC ( int label ) : int
label int
리턴 int

GetStackTop() 공개 메소드

public GetStackTop ( ) : short
리턴 short

IsUnderStringSizeLimit() 공개 메소드

Check if k fits limit on string constant size imposed by class file format.
Check if k fits limit on string constant size imposed by class file format.
public IsUnderStringSizeLimit ( string k ) : bool
k string the string constant
리턴 bool

MarkHandler() 공개 메소드

public MarkHandler ( int theLabel ) : void
theLabel int
리턴 void

MarkLabel() 공개 메소드

public MarkLabel ( int label ) : void
label int
리턴 void

MarkLabel() 공개 메소드

public MarkLabel ( int label, short stackTop ) : void
label int
stackTop short
리턴 void

MarkTableSwitchCase() 공개 메소드

public MarkTableSwitchCase ( int switchStart, int caseIndex ) : void
switchStart int
caseIndex int
리턴 void

MarkTableSwitchCase() 공개 메소드

public MarkTableSwitchCase ( int switchStart, int caseIndex, int stackTop ) : void
switchStart int
caseIndex int
stackTop int
리턴 void

MarkTableSwitchDefault() 공개 메소드

public MarkTableSwitchDefault ( int switchStart ) : void
switchStart int
리턴 void

SetFlags() 공개 메소드

Set the class's flags.
Set the class's flags. Flags must be a set of the following flags, bitwise or'd together: ACC_PUBLIC ACC_PRIVATE ACC_PROTECTED ACC_FINAL ACC_ABSTRACT TODO: check that this is the appropriate set
public SetFlags ( short flags ) : void
flags short the set of class flags to set
리턴 void

SetStackTop() 공개 메소드

public SetStackTop ( short n ) : void
n short
리턴 void

SetTableSwitchJump() 공개 메소드

Set a jump case for a tableswitch instruction.
Set a jump case for a tableswitch instruction. The jump target should be marked as a super block start for stack map generation.
public SetTableSwitchJump ( int switchStart, int caseIndex, int jumpTarget ) : void
switchStart int
caseIndex int
jumpTarget int
리턴 void

StartMethod() 공개 메소드

Add a method and begin adding code.
Add a method and begin adding code. This method must be called before other methods for adding code, exception tables, etc. can be invoked.
public StartMethod ( string methodName, string type, short flags ) : void
methodName string the name of the method
type string a string representing the type
flags short /// the attributes of the field, such as ACC_PUBLIC, etc. /// bitwise or'd together ///
리턴 void

StopMethod() 공개 메소드

Complete generation of the method.
Complete generation of the method. After this method is called, no more code can be added to the method begun with startMethod.
public StopMethod ( short maxLocals ) : void
maxLocals short /// the maximum number of local variable slots /// (a.k.a. Java registers) used by the method ///
리턴 void

ToByteArray() 공개 메소드

Get the class file as array of bytesto the OutputStream.
Get the class file as array of bytesto the OutputStream.
public ToByteArray ( ) : byte[]
리턴 byte[]

Write() 공개 메소드

Write the class file to the OutputStream.
Write the class file to the OutputStream.
if writing to the stream produces an exception
public Write ( Stream oStream ) : void
oStream Stream the stream to write to
리턴 void