Class ByteBufferDecoder

  • All Implemented Interfaces:
    Decoder

    public final class ByteBufferDecoder
    extends Object
    implements Decoder
    Decoder using a byte buffer.
    • Constructor Detail

      • ByteBufferDecoder

        public ByteBufferDecoder​(ByteBuffer buf)
    • Method Detail

      • decodeSignedShort

        public short decodeSignedShort()
                                throws Exception
        Description copied from interface: Decoder
        Decodes a signed short integer. The encoding format depends on the implementation.
        Specified by:
        decodeSignedShort in interface Decoder
        Returns:
        the decoded value
        Throws:
        Exception - if an error occurs during decoding
      • decodeUnsignedShort

        public short decodeUnsignedShort()
                                  throws Exception
        Description copied from interface: Decoder
        Decodes an unsigned short integer. The encoding format depends on the implementation.
        Specified by:
        decodeUnsignedShort in interface Decoder
        Returns:
        the decoded value
        Throws:
        Exception - if an error occurs during decoding
      • decode16

        public short decode16()
                       throws Exception
        Description copied from interface: Decoder
        Decodes a signed short integer. The encoding format is the 2's complement representation encoded in 2 bytes.
        Specified by:
        decode16 in interface Decoder
        Returns:
        the decoded value
        Throws:
        Exception - if an error occurs during decoding
      • decodeSignedInt

        public int decodeSignedInt()
                            throws Exception
        Description copied from interface: Decoder
        Decodes a signed integer. The encoding format depends on the implementation.
        Specified by:
        decodeSignedInt in interface Decoder
        Returns:
        the decoded value
        Throws:
        Exception - if an error occurs during decoding
      • decodeUnsignedInt

        public int decodeUnsignedInt()
                              throws Exception
        Description copied from interface: Decoder
        Decodes an unsigned integer. The encoding format depends on the implementation.
        Specified by:
        decodeUnsignedInt in interface Decoder
        Returns:
        the decoded value
        Throws:
        Exception - if an error occurs during decoding
      • decode32

        public int decode32()
                     throws Exception
        Description copied from interface: Decoder
        Decodes a signed integer. The encoding format is the 2's complement representation encoded in 4 bytes.
        Specified by:
        decode32 in interface Decoder
        Returns:
        the decoded value
        Throws:
        Exception - if an error occurs during decoding
      • decodeUnsignedLong

        public long decodeUnsignedLong()
                                throws Exception
        Description copied from interface: Decoder
        Decodes an unsigned long integer. The encoding format depends on the implementation.
        Specified by:
        decodeUnsignedLong in interface Decoder
        Returns:
        the decoded value
        Throws:
        Exception - if an error occurs during decoding
      • decodeSignedLong

        public long decodeSignedLong()
                              throws Exception
        Description copied from interface: Decoder
        Decodes a signed long integer. The encoding format depends on the implementation.
        Specified by:
        decodeSignedLong in interface Decoder
        Returns:
        the decoded value
        Throws:
        Exception - if an error occurs during decoding
      • decode64

        public long decode64()
                      throws Exception
        Description copied from interface: Decoder
        Decodes a signed long integer. The encoding format is the 2's complement representation encoded in 8 bytes.
        Specified by:
        decode64 in interface Decoder
        Returns:
        the decoded value
        Throws:
        Exception - if an error occurs during decoding
      • decodeNullableString

        public String decodeNullableString()
                                    throws Exception
        Description copied from interface: Decoder
        Decodes a string that can be null. Be careful, since Joram 5.19, by default String are encoded using UTF-8.
        Specified by:
        decodeNullableString in interface Decoder
        Returns:
        the decoded value
        Throws:
        Exception - if an error occurs during decoding
      • decodeString

        public String decodeString()
                            throws Exception
        Description copied from interface: Decoder
        Decodes a string that cannot be null. Be careful, since Joram 5.19, by default String are encoded using UTF-8.
        Specified by:
        decodeString in interface Decoder
        Returns:
        the decoded value
        Throws:
        Exception - if an error occurs during decoding
      • decodeString

        public String decodeString​(int length)
                            throws Exception
        Description copied from interface: Decoder
        Decodes a string that cannot be null. Be careful, since Joram 5.19, by default String are encoded using UTF-8.
        Specified by:
        decodeString in interface Decoder
        Parameters:
        length - the length of the string
        Returns:
        the decoded value
        Throws:
        Exception - if an error occurs during decoding
      • decodeByte

        public byte decodeByte()
                        throws Exception
        Description copied from interface: Decoder
        Decodes a byte.
        Specified by:
        decodeByte in interface Decoder
        Returns:
        the decoded value
        Throws:
        Exception - if an error occurs during decoding
      • decodeNullableByteArray

        public byte[] decodeNullableByteArray()
                                       throws Exception
        Description copied from interface: Decoder
        Decodes a byte array that can be null.
        Specified by:
        decodeNullableByteArray in interface Decoder
        Returns:
        the decoded value
        Throws:
        Exception - if an error occurs during decoding
      • decodeByteArray

        public byte[] decodeByteArray()
                               throws Exception
        Description copied from interface: Decoder
        Decodes a byte array that cannot be null.
        Specified by:
        decodeByteArray in interface Decoder
        Returns:
        the decoded value
        Throws:
        Exception - if an error occurs during decoding
      • decodeByteArray

        public byte[] decodeByteArray​(int length)
                               throws Exception
        Description copied from interface: Decoder
        Decodes a byte array that cannot be null.
        Specified by:
        decodeByteArray in interface Decoder
        Parameters:
        length - the length of the array
        Returns:
        the decoded value
        Throws:
        Exception - if an error occurs during decoding
      • decodeBoolean

        public boolean decodeBoolean()
                              throws Exception
        Description copied from interface: Decoder
        Decodes a boolean.
        Specified by:
        decodeBoolean in interface Decoder
        Returns:
        the decoded value
        Throws:
        Exception - if an error occurs during decoding
      • decodeFloat

        public float decodeFloat()
                          throws Exception
        Description copied from interface: Decoder
        Decodes a float.
        Specified by:
        decodeFloat in interface Decoder
        Returns:
        the decoded value
        Throws:
        Exception - if an error occurs during decoding
      • decodeDouble

        public double decodeDouble()
                            throws Exception
        Description copied from interface: Decoder
        Decodes a double.
        Specified by:
        decodeDouble in interface Decoder
        Returns:
        the decoded value
        Throws:
        Exception - if an error occurs during decoding