@Override
 public void writeData(SpoutOutputStream output) throws IOException {
   super.writeData(output);
   output.writeString(getUrl());
   output.writeBoolean(isDrawingAlphaChannel());
   output.writeShort((short) top);
   output.writeShort((short) left);
 }
  public PacketAddonData(AddonPacket packet) {
    this.packet = packet;
    SpoutOutputStream stream = new SpoutOutputStream();

    boolean sandboxed = SpoutClient.isSandboxed();
    SpoutClient.enableSandbox();
    try {
      packet.write(stream);
    } catch (Exception e) {
      e.printStackTrace();
    }
    if (!sandboxed) {
      SpoutClient.disableSandbox();
    }
    ByteBuffer buffer = stream.getRawBuffer();
    data = new byte[buffer.capacity() - buffer.remaining()];
    System.arraycopy(buffer.array(), 0, data, 0, data.length);
    needsCompression = data.length > 512;
  }
 public void writeData(SpoutOutputStream output) throws IOException {
   output.writeString(AddonPacket.getPacketId(packet.getClass()));
   output.writeInt(data.length);
   output.writeBoolean(compressed);
   output.write(data);
 }
 public void writeData(SpoutOutputStream output) throws IOException {
   output.writeString(versionString);
 }
 public void writeData(SpoutOutputStream output) throws IOException {
   output.writeInt(this.cx);
   output.writeInt(this.cz);
 }
 @Override
 public void writeData(SpoutOutputStream output) throws IOException {
   super.writeData(output);
   output.writeBoolean(isBgVisible());
 }