📄 actionblockwriter.java
字号:
SWFActionBlock block = new SubBlockWriter( fixer, mOut, mByteOut, mFixers, mLabelToInfo, mActionCount, mFlashVersion );
return block;
}
public TryCatchFinally _try( String varName ) throws IOException {
return _try( varName, 0 );
}
public TryCatchFinally _try( int regNum ) throws IOException {
return _try( null, regNum );
}
private TryCatchFinally _try( String varName, int regNum ) throws IOException {
writeCode( TRY );
int actionLengthAddr = mOut.getCount();
mOut.writeUI16( 0 ); //will be fixed up
BlockLengthFixer lengthFixer = new BlockLengthFixer( actionLengthAddr );
mFixers.add( lengthFixer );
int flagsAddr = mOut.getCount();
mOut.writeUI8( 0 ); //flags will be fixed up
final TryFlagsFixer flagsFixer = new TryFlagsFixer( flagsAddr );
mFixers.add( flagsFixer );
int tryBlockSizeAddr = mOut.getCount();
mOut.writeUI16( 0 ); //will be fixed up
final BlockLengthFixer tryBlockFixer = new BlockLengthFixer( tryBlockSizeAddr );
mFixers.add( tryBlockFixer );
int catchBlockSizeAddr = mOut.getCount();
mOut.writeUI16( 0 ); //will be fixed up
final BlockLengthFixer catchBlockFixer = new BlockLengthFixer( catchBlockSizeAddr );
mFixers.add( catchBlockFixer );
int finallyBlockSizeAddr = mOut.getCount();
mOut.writeUI16( 0 ); //will be fixed up
final BlockLengthFixer finallyBlockFixer = new BlockLengthFixer( finallyBlockSizeAddr );
mFixers.add( finallyBlockFixer );
if( varName != null ) {
mOut.writeString( varName, mStringEncoding );
} else {
mOut.writeUI8( regNum );
flagsFixer.catchInRegister();
}
lengthFixer.setBlockLength( mOut.getCount() - flagsAddr );
return new TryCatchFinally() {
public SWFActionBlock tryBlock() throws IOException {
return new SubBlockWriter( tryBlockFixer, mOut, mByteOut, mFixers, mLabelToInfo, mActionCount, mFlashVersion );
}
public SWFActionBlock catchBlock() throws IOException {
flagsFixer.hasCatchBlock();
return new SubBlockWriter( catchBlockFixer, mOut, mByteOut, mFixers, mLabelToInfo, mActionCount, mFlashVersion );
}
public SWFActionBlock finallyBlock() throws IOException {
flagsFixer.hasFinallyBlock();
return new SubBlockWriter( finallyBlockFixer, mOut, mByteOut, mFixers, mLabelToInfo, mActionCount, mFlashVersion );
}
public void endTry() throws IOException {
//nada
}
};
}
public void defineLocalValue() throws IOException
{
writeCode( DEFINE_LOCAL_VAL );
}
public void defineLocal() throws IOException
{
writeCode( DEFINE_LOCAL );
}
public void deleteProperty() throws IOException
{
writeCode( DEL_VAR );
}
public void deleteThreadVars() throws IOException
{
writeCode( DEL_THREAD_VARS );
}
public void enumerate() throws IOException
{
writeCode( ENUMERATE );
}
public void typedEquals() throws IOException
{
writeCode( TYPED_EQUALS );
}
public void getMember() throws IOException
{
writeCode( GET_MEMBER );
}
public void initObject() throws IOException
{
writeCode( INIT_OBJECT );
}
public void newMethod() throws IOException
{
writeCode( CALL_NEW_METHOD );
}
public void newObject() throws IOException
{
writeCode( NEW_OBJECT );
}
public void setMember() throws IOException
{
writeCode( SET_MEMBER );
}
public void getTargetPath() throws IOException
{
writeCode( GET_TARGET_PATH );
}
public SWFActionBlock startWith() throws IOException
{
writeCode( WITH );
mOut.writeUI16( 2 );
int blockSizeAddr = mOut.getCount();
mOut.writeUI16( 0 ); //codeSize - will be fixed up later
BlockLengthFixer fixer = new BlockLengthFixer( blockSizeAddr );
mFixers.add( fixer );
SWFActionBlock block = new SubBlockWriter( fixer, mOut, mByteOut, mFixers, mLabelToInfo, mActionCount,mFlashVersion );
return block;
}
public void duplicate() throws IOException
{
writeCode( DUPLICATE );
}
public void returnValue() throws IOException
{
writeCode( RETURN );
}
public void swap() throws IOException
{
writeCode( SWAP );
}
public void storeInRegister( int registerNumber ) throws IOException
{
writeCode( REGISTER );
mOut.writeUI16( 1 );
mOut.writeUI8( registerNumber );
}
public void convertToNumber() throws IOException
{
writeCode( CONVERT_TO_NUMBER );
}
public void convertToString() throws IOException
{
writeCode( CONVERT_TO_STRING );
}
public void typeOf() throws IOException
{
writeCode( TYPEOF );
}
public void typedAdd() throws IOException
{
writeCode( TYPED_ADD );
}
public void typedLessThan() throws IOException
{
writeCode( TYPED_LESS_THAN );
}
public void modulo() throws IOException
{
writeCode( MODULO );
}
public void bitAnd() throws IOException
{
writeCode( BIT_AND );
}
public void bitOr() throws IOException
{
writeCode( BIT_OR );
}
public void bitXor() throws IOException
{
writeCode( BIT_XOR );
}
public void shiftLeft() throws IOException
{
writeCode( SHIFT_LEFT );
}
public void shiftRight() throws IOException
{
writeCode( SHIFT_RIGHT );
}
public void shiftRightUnsigned() throws IOException
{
writeCode( SHIFT_UNSIGNED );
}
public void decrement() throws IOException
{
writeCode( DECREMENT );
}
public void increment() throws IOException
{
writeCode( INCREMENT );
}
protected void flushPushValues() throws IOException {
writeCode( PUSH );
ByteArrayOutputStream baout = new ByteArrayOutputStream();
OutStream bout = new OutStream( baout );
for( Iterator e = mPushValues.iterator(); e.hasNext(); )
{
PushValue pv = (PushValue) e.next();
pv.write( bout );
}
mPushValues.clear();
bout.flush();
byte[] data = baout.toByteArray();
mOut.writeUI16( data.length );
mOut.write( data );
}
private void push( PushValue value ) throws IOException {
mPushValues.add( value );
if( mFlashVersion < 5 ) flushPushValues();
}
public void push( String value ) throws IOException {
push( new PushStringVal( value ) );
}
public void push( float value ) throws IOException {
push( new PushFloatVal( value ) );
}
public void push( double value ) throws IOException {
push( new PushDoubleVal( value ) );
}
public void pushNull() throws IOException {
push( new PushNull() );
}
public void pushUndefined() throws IOException {
push( new PushUndefined() );
}
public void pushRegister( int registerNumber ) throws IOException {
push( new PushRegister( registerNumber ) );
}
public void push( boolean value ) throws IOException {
push( new PushBooleanVal( value ) );
}
public void push( int value ) throws IOException {
push( new PushIntegerVal( value ) );
}
public void lookup( int dictionaryIndex ) throws IOException {
push( new PushLookup( dictionaryIndex ) );
}
/**
* @see com.anotherbigidea.flash.interfaces.SWFActions#enumerateObject()
*/
public void enumerateObject() throws IOException {
writeCode( ENUMERATE_OBJECT );
}
/**
* @see com.anotherbigidea.flash.interfaces.SWFActions#greaterThan()
*/
public void greaterThan() throws IOException {
writeCode( GREATER );
}
/**
* @see com.anotherbigidea.flash.interfaces.SWFActions#instanceOf()
*/
public void instanceOf() throws IOException {
writeCode( INSTANCE_OF );
}
/**
* @see com.anotherbigidea.flash.interfaces.SWFActions#strictEquals()
*/
public void strictEquals() throws IOException {
writeCode( STRICT_EQUALS );
}
/**
* @see com.anotherbigidea.flash.interfaces.SWFActions#stringGreaterThan()
*/
public void stringGreaterThan() throws IOException {
writeCode( STRING_GREATER );
}
public void _extends() throws IOException {
writeCode( EXTENDS );
}
public void _implements() throws IOException {
writeCode( IMPLEMENTS_OP );
}
public void _throw() throws IOException {
writeCode( THROW );
}
public void cast() throws IOException {
writeCode( CAST_OP );
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -