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

📄 fsmovieevent.java

📁 利用opensource的开源jar实现生成flash文件
💻 JAVA
字号:
/*
 * FSMovieEvent.java
 * Transform
 * 
 * Copyright (c) 2001-2006 Flagstone Software Ltd. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 *
 *  * Redistributions of source code must retain the above copyright notice, this
 *    list of conditions and the following disclaimer.
 *  * Redistributions in binary form must reproduce the above copyright notice, 
 *    this list of conditions and the following disclaimer in the documentation 
 *    and/or other materials provided with the distribution.
 *  * Neither the name of Flagstone Software Ltd. nor the names of its contributors 
 *    may be used to endorse or promote products derived from this software 
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
 * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package com.flagstone.transform;

/**
 * @deprecated the FSMovieEvent will no longer be supported in future releases
 * to report decoding and encoding events and to report errors. Instead methods
 * which report errors through exceptions are preferred. If an error occurs then
 * it is due to an error which cannot be easily recovered from therefore the
 * FSMovieEvent will no longer be used.
 * 
 * The FSMovieEvent class is a container class for the information generated for events 
 * while a movie is being encoded or decoded.
 *
 */
public class FSMovieEvent
{
    /** Identifies an event generated while a movie is being encoded. */
    public static final int Encode = 0;
    /** Identifies an event generated while a movie is being decoded. */
    public static final int Decode = 1;

    /** Identifies an event generated when an object in a movie begins to be encoded or decoded. */
    public static final int Begin = 0;
    /** Identifies an event generated when an object in a movie completes being encoded or decoded. */
    public static final int End = 1;
    /** Identifies an error occurred while a movie is being encoded or decoded. */
    public static final int Error  = 2;
    /** Identifies a value read from the binary Flash file as it is being decoded. */
    public static final int Value = 3;

    private int action = 0;
    private int event = 0;
    private int location = 0;
    private int length = 0;

    private Object value;

    /**
     * Constructs an FSMovieEvent object reporting whether the event.
     * 
     * @param anAction identifies whether the event was generated while the movie was being encoded
     * or decoded.
     * 
     * @param anEvent identifies the type of event, signalling either the start and end of each object
     * being decoded, a value decoded while will be assigned to an object attributes or whether an
     * error occurred.
     * 
     * @param aLocation identifies the offset in bits from the start of the movie where the event occurred.
     * 
     * @param aLength identifies the number of bits involved when decoding a value. This is set to zero 
     * for Begin, End and Error events.
     * 
     * @param aValue depends on the type of event generated. For Begin and End events, aValue is a String
     * containing the name of the object being encoded or decoded. For Value events, aValue is an object
     * wrapping the value being decoded. For Error events, aValue is an error message describing the error
     * that occurred.
     */
    public FSMovieEvent(int anAction, int anEvent, int aLocation, int aLength, Object aValue)
    {
        action = anAction;
        event = anEvent;
        location = aLocation;
        length = aLength;
        value = aValue;
    }
    
    /**
     * Returns the type of action that generated the event, either Decode when a movie is being decoded
     * or Encode when a movie is being encoded.
     * 
     * @return FSMovieEvent.Decode or FSMovieEvent.Encode according to whether a movie is being decoded 
     * or encoded.
     */
    public int getAction() 
    { 
        return action;
    }

    /**
     * Identifies the type of event that occurred.
     * 
     * FSMovieEvent.Begin occurs when an object in a movie begins the process of being encoded
     * or decoded.
     * 
     * FSMovieEvent.End occurs when an object in a movie completes the process of being encoded
     * or decoded.
     * 
     * FSMovieEvent.Value occurs when an attribute of an object is decoded.
     * 
     * FSMovieEvent.Error occurs when an error is detected while encoding or decoding a movie.
     * 
     * @return the type of event that occurred.
     */
    public int getEvent() 
    { 
        return event;
    }

    /**
     * Identifies the offset in bits from the start of the movie where the event occurred.
     * 
     * @return the bit offset where the event occurred.
     */
    public int getLocation() 
    { 
        return location;
    }

    /**
     * Identifies the number of bits involved when decoding a value. This is set to zero 
     * for Begin, End and Error events.
     * 
     * @return the number of bits read from the file for the decoded value.
     */
    public int getLength() 
    { 
        return length;
    }

    /**
     * Returns an object containing information on the event. The object depends on the type of event 
     * generated. For Begin and End events, aValue is a String containing the name of the object being 
     * encoded or decoded. For Value events, aValue is an object wrapping the value being decoded. For 
     * Error events, aValue is String containing an error message describing the error that occurred.
     * 
     * @return an object containing information associated with the event.
     */
    public Object getValue() 
    { 
        return value;
    }

    /**
     * Generates a string representation of the event object.
     * 
     * @return a string reporting the values in the attributes.
     */
    public String toString()
    {
        String description = null;

        description = "FSMovieEvent: { action = " + action + "; event = " + event + "; location = " + location + "; length = " + length + "; value = " + value.toString() + "};";

        return description;
    }
}

⌨️ 快捷键说明

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