Class BinaryFormat


  • public class BinaryFormat
    extends java.lang.Object
    Class for serializing Slime data into binary format, or deserializing the binary format into a Slime object.
    • Constructor Summary

      Constructors 
      Constructor Description
      BinaryFormat()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Slime decode​(byte[] data)
      Take binary data and deserialize it into a Slime object.
      static Slime decode​(byte[] data, int offset, int length)
      Take binary data and deserialize it into a Slime object.
      static byte[] encode​(Slime slime)
      Take a Slime object and serialize it into binary format.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BinaryFormat

        public BinaryFormat()
    • Method Detail

      • encode

        public static byte[] encode​(Slime slime)
        Take a Slime object and serialize it into binary format.
        Parameters:
        slime - the object which is to be serialized.
        Returns:
        a new byte array with just the encoded slime.
      • decode

        public static Slime decode​(byte[] data)
        Take binary data and deserialize it into a Slime object. The data is assumed to be the binary representation as if obtained by a call to the @ref encode() method. If the binary data can't be deserialized without problems the returned Slime object will instead only contain the three fields "partial_result" (contains anything successfully decoded before encountering problems), "offending_input" (containing any data that could not be deserialized) and "error_message" (a string describing the problem encountered).
        Parameters:
        data - the data to be deserialized.
        Returns:
        a new Slime object constructed from the data.
      • decode

        public static Slime decode​(byte[] data,
                                   int offset,
                                   int length)
        Take binary data and deserialize it into a Slime object. The data is assumed to be the binary representation as if obtained by a call to the @ref encode() method. If the binary data can't be deserialized without problems the returned Slime object will instead only contain the three fields "partial_result" (contains anything successfully decoded before encountering problems), "offending_input" (containing any data that could not be deserialized) and "error_message" (a string describing the problem encountered).
        Parameters:
        data - array containing the data to be deserialized.
        offset - where in the array to start deserializing.
        length - how many bytes the deserializer is allowed to consume.
        Returns:
        a new Slime object constructed from the data.