Class PacketMarshaller

java.lang.Object
megamek.common.net.marshalling.PacketMarshaller

public abstract class PacketMarshaller extends Object
Generic marshaller that [un]marshalls the Packet
  • Field Details

    • NATIVE_SERIALIZATION_MARSHALING

      public static final int NATIVE_SERIALIZATION_MARSHALING
      Java native serialization marshalling
      See Also:
  • Constructor Details

    • PacketMarshaller

      public PacketMarshaller()
  • Method Details

    • marshall

      @Deprecated(since="0.51.0", forRemoval=true) @Nullable public byte[] marshall(Packet packet)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Marshalls the packet data into the byte[]
      Parameters:
      packet - packet to marshall
      Returns:
      marshalled representation of the given Packet
    • marshall

      public abstract void marshall(Packet packet, OutputStream stream) throws Exception
      Marshalls the packet data into the given OutputStream
      Parameters:
      packet - packet to marshall
      stream - OutputStream to marshall the Packet to
      Throws:
      Exception
    • unmarshall

      @Deprecated(since="0.51.0", forRemoval=true) @Nullable public Packet unmarshall(byte... data)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Unmarshalls the packet data from the given byte[] array
      Parameters:
      data - byte[] array to unmarshall the packet from
      Returns:
      the new Packetunmarshalled from the given byte[] array
    • unmarshall

      public abstract Packet unmarshall(InputStream stream) throws Exception
      Unmarshalls the packet data from the given InputStream
      Parameters:
      stream - InputStream to unmarshall the packet from
      Returns:
      the new Packetunmarshalled from the given InputStream
      Throws:
      Exception