Package org.jcsp.net2

Class ObjectNetworkMessageFilter.FilterRX

java.lang.Object
org.jcsp.net2.ObjectNetworkMessageFilter.FilterRX
All Implemented Interfaces:
NetworkMessageFilter.FilterRx
Enclosing class:
ObjectNetworkMessageFilter

public static final class ObjectNetworkMessageFilter.FilterRX extends Object implements NetworkMessageFilter.FilterRx
The receiving (decoding) filter for Objects
  • Field Details

    • objectStreamHeader

      static final byte[] objectStreamHeader
      These four bytes represent the normal header expected in Java for object streams
    • bais

      private final ResettableByteArrayInputStream bais
      The byte array stream used to connect to the ObjectInputStream
    • ois

      private final ObjectInputStream ois
      The ObjectInputStream used to read the objects from.
  • Constructor Details

    • FilterRX

      public FilterRX()
      Creates a new incoming object filter
  • Method Details

    • filterRX

      public Object filterRX(byte[] bytes) throws IOException
      Decodes an incoming byte array, converting it back into an Object
      Specified by:
      filterRX in interface NetworkMessageFilter.FilterRx
      Parameters:
      bytes - The byte representation of the object
      Returns:
      The recreated Object
      Throws:
      IOException - Thrown of something goes wrong during the decoding