Interface BinarySerializer<T>

    • Method Detail

      • serialize

        void serialize​(T t,
                       @WillNotClose
                       OutputStream os)
                throws IOException
        Write an object of type T to the given os.

        If the os also implements DataOutput, prefer using serialize(Object, DataOutput). This method will create a adapter on os before calling it.

        Parameters:
        t - the object to serialize
        os - the output stream
        Throws:
        IOException - if an I/O error occurs during the serialization
      • serialize

        void serialize​(T t,
                       @WillNotClose
                       DataOutput out)
                throws IOException
        Write an object of type T to the given out.
        Parameters:
        t - the object to serialize
        out - the output stream
        Throws:
        IOException - if an I/O error occurs during the serialization
      • deserialize

        @Nonnull
        T deserialize​(@WillNotClose
                      InputStream is)
               throws IOException
        Reads and assembles an object of type T from the given is.

        If the is also implements DataInput, prefer using deserialize(DataInput). This method will create a adapter on is before calling it.

        Parameters:
        is - the input stream
        Returns:
        the deserialized object
        Throws:
        IOException - if an I/O error occurs during the deserialization
      • deserialize

        @Nonnull
        T deserialize​(@WillNotClose
                      DataInput in)
               throws IOException
        Reads and assembles an object of type T from the given in.
        Parameters:
        in - the input stream
        Returns:
        the deserialized object
        Throws:
        IOException - if an I/O error occurs during the deserialization