All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.red5.server.net.rtmp.event.SWFResponse Maven / Gradle / Ivy

There is a newer version: 2.3.3.1
Show newest version
package org.red5.server.net.rtmp.event;

import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.Arrays;

/**
 * Control message used in response to a SWF verification request.
 * 
 * @author Paul Gregoire ([email protected])
 */
public class SWFResponse extends Ping {

    private static final long serialVersionUID = -6478248060425544925L;

    private byte[] bytes;

    public SWFResponse() {
        super();
        this.eventType = Ping.PONG_SWF_VERIFY;
    }

    public SWFResponse(byte[] bytes) {
        this();
        this.bytes = bytes;
    }

    /**
     * @return the bytes
     */
    public byte[] getBytes() {
        return bytes;
    }

    /**
     * @param bytes
     *            the bytes to set
     */
    public void setBytes(byte[] bytes) {
        this.bytes = bytes;
    }

    @Override
    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
        super.readExternal(in);
        eventType = in.readShort();
        if (bytes == null) {
            bytes = new byte[42];
        }
        in.read(bytes);
    }

    @Override
    public void writeExternal(ObjectOutput out) throws IOException {
        super.writeExternal(out);
        out.writeShort(eventType);
        out.write(bytes);
    }

    /* (non-Javadoc)
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        return "SWFResponse [bytes=" + Arrays.toString(bytes) + "]";
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy