⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 actionwriter.java

📁 java版本的flash文件(swf)播放器
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
    /**
     * SWFActions interface
     */     
    public void defineLocal() throws IOException
    {
        writeCode( DEFINE_LOCAL );
    }   

    /**
     * SWFActions interface
     */     
    public void deleteProperty() throws IOException
    {
        writeCode( DEL_VAR );
    }   

    /**
     * SWFActions interface
     */     
    public void deleteThreadVars() throws IOException
    {
        writeCode( DEL_THREAD_VARS );
    }   

    /**
     * SWFActions interface
     */     
    public void enumerate() throws IOException
    {
        writeCode( ENUMERATE );
    }   

    /**
     * SWFActions interface
     */     
    public void typedEquals() throws IOException
    {
        writeCode( TYPED_EQUALS );
    }   

    /**
     * SWFActions interface
     */     
    public void getMember() throws IOException
    {
        writeCode( GET_MEMBER );
    }   

    /**
     * SWFActions interface
     */         
    public void initObject() throws IOException
    {
        writeCode( INIT_OBJECT );
    }   

    /**
     * SWFActions interface
     */     
    public void newMethod() throws IOException
    {
        writeCode( CALL_NEW_METHOD );
    }   

    /**
     * SWFActions interface
     */     
    public void newObject() throws IOException
    {
        writeCode( NEW_OBJECT );
    }   

    /**
     * SWFActions interface
     */     
    public void setMember() throws IOException
    {
        writeCode( SET_MEMBER );
    }   

    /**
     * SWFActions interface
     */     
    public void getTargetPath() throws IOException
    {
        writeCode( GET_TARGET_PATH );
    }   
    
    /**
     * SWFActions interface
     */ 
    public void startWith() throws IOException
    {
        writeCode( WITH );
        out.writeUI16( 2 );
        out.writeUI16( 0 );  //codeSize - will be fixed up later
        
        //--push the block start info
        if( blockStack == null ) blockStack = new Stack();
        blockStack.push( new int[]{ (int)out.getCount(), 0 } );        
    }   
    
    /**
     * SWFActions interface
     */ 
    public void duplicate() throws IOException
    {
        writeCode( DUPLICATE );
    }   
    
    /**
     * SWFActions interface
     */ 
    public void returnValue() throws IOException
    {
        writeCode( RETURN );
    }   
    
    /**
     * SWFActions interface
     */ 
    public void swap() throws IOException
    {
        writeCode( SWAP );
    }   
    
    /**
     * SWFActions interface
     */ 
    public void storeInRegister( int registerNumber ) throws IOException
    {
        writeCode( REGISTER );
        out.writeUI16( 1 );
        out.writeUI8( registerNumber );
    }   
        
    /**
     * SWFActions interface
     */ 
    public void convertToNumber() throws IOException
    {
        writeCode( CONVERT_TO_NUMBER );
    }   
    
    /**
     * SWFActions interface
     */ 
    public void convertToString() throws IOException
    {
        writeCode( CONVERT_TO_STRING );
    }   
    
    /**
     * SWFActions interface
     */ 
    public void typeOf() throws IOException
    {
        writeCode( TYPEOF );
    }   
    
    /**
     * SWFActions interface
     */ 
    public void typedAdd() throws IOException
    {
        writeCode( TYPED_ADD );
    }   
    
    /**
     * SWFActions interface
     */ 
    public void typedLessThan() throws IOException
    {
        writeCode( TYPED_LESS_THAN );
    }   
    
    /**
     * SWFActions interface
     */ 
    public void modulo() throws IOException
    {
        writeCode( MODULO );
    }   
        
    /**
     * SWFActions interface
     */ 
    public void bitAnd() throws IOException
    {
        writeCode( BIT_AND );
    }   
    
    /**
     * SWFActions interface
     */ 
    public void bitOr() throws IOException
    {
        writeCode( BIT_OR );
    }   
    
    /**
     * SWFActions interface
     */ 
    public void bitXor() throws IOException
    {
        writeCode( BIT_XOR );
    }   
    
    /**
     * SWFActions interface
     */ 
    public void shiftLeft() throws IOException
    {
        writeCode( SHIFT_LEFT );
    }   
    
    /**
     * SWFActions interface
     */ 
    public void shiftRight() throws IOException
    {
        writeCode( SHIFT_RIGHT );
    }   
    
    /**
     * SWFActions interface
     */ 
    public void shiftRightUnsigned() throws IOException
    {
        writeCode( SHIFT_UNSIGNED );
    }   
        
    /**
     * SWFActions interface
     */ 
    public void decrement() throws IOException
    {
        writeCode( DECREMENT );
    }   
    
    /**
     * SWFActions interface
     */ 
    public void increment() throws IOException
    {
        writeCode( INCREMENT );
    }   
    
    protected void flushPushValues() throws IOException
    {
        out.writeUI8( PUSH );
        count++;
        
        ByteArrayOutputStream baout = new ByteArrayOutputStream();
        OutStream bout = new OutStream( baout );
        
        for( Enumeration enum = pushValues.elements(); enum.hasMoreElements(); )
        {
            Object value = enum.nextElement();
            
            if( value instanceof String )
            {
                bout.writeUI8( PUSHTYPE_STRING );
                bout.writeString( value.toString(), mStringEncoding );
            }
            else if( value instanceof Boolean )
            {
                bout.writeUI8( PUSHTYPE_BOOLEAN );
                bout.writeUI8( ((Boolean)value).booleanValue() ? 1 : 0 );
            }
            else if( value instanceof Integer )
            {
                bout.writeUI8( PUSHTYPE_INTEGER );
                bout.writeSI32( ((Integer)value).intValue() );                
            }
            else if( value instanceof Short )
            {
                bout.writeUI8( PUSHTYPE_LOOKUP );
                bout.writeUI8( ((Short)value).intValue() );                
            }
            else if( value instanceof Byte )
            {
                bout.writeUI8( PUSHTYPE_REGISTER );
                bout.writeUI8( ((Byte)value).intValue() );                                   
            }
            else if( value instanceof Float )
            {
                bout.writeUI8( PUSHTYPE_FLOAT );
                bout.writeFloat( ((Float)value).floatValue() );                
            }
            else if( value instanceof Double )
            {
                bout.writeUI8( PUSHTYPE_DOUBLE );
                bout.writeDouble( ((Double)value).doubleValue() );
            }
            else
            {
                bout.writeUI8( PUSHTYPE_NULL );
            }
        }

        pushValues.removeAllElements();
        
        bout.flush();
        byte[] data = baout.toByteArray();
        out.writeUI16( data.length );
        out.write( data );
    }
        
    /**
     * SWFActions interface
     */
    public void push( String value ) throws IOException
    {
        pushValues.addElement( value );
        if( flashVersion < 5 ) flushPushValues();
    }
    
    /**
     * SWFActions interface
     */
    public void push( float  value ) throws IOException
    {
        pushValues.addElement( new Float( value ) );
        if( flashVersion < 5 ) flushPushValues();
    }
    
    /**
     * SWFActions interface
     */
    public void push( double value ) throws IOException
    {
        pushValues.addElement( new Double( value ) );
        if( flashVersion < 5 ) flushPushValues();
    }
    
    /**
     * SWFActions interface
     */
    public void pushNull() throws IOException
    {
        pushValues.addElement( new Object() );
        if( flashVersion < 5 ) flushPushValues();
    }
    
    /**
     * SWFActions interface
     */
    public void pushRegister( int registerNumber ) throws IOException
    {
        pushValues.addElement( new Byte( (byte)registerNumber ) );
        if( flashVersion < 5 ) flushPushValues();
    }
    
    /**
     * SWFActions interface
     */
    public void push( boolean value ) throws IOException
    {
        pushValues.addElement( new Boolean( value ) );
        if( flashVersion < 5 ) flushPushValues();
    }
    
    /**
     * SWFActions interface
     */
    public void push( int value ) throws IOException
    {
        pushValues.addElement( new Integer( value ) );
        if( flashVersion < 5 ) flushPushValues();
    }

    /**
     * SWFActions interface
     */
    public void lookup( int dictionaryIndex ) throws IOException
    {
        pushValues.addElement( new Short( (short)dictionaryIndex ) );
        if( flashVersion < 5 ) flushPushValues();
    }    
    
	/**
	 * @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 );
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -