Class BigEndianDatatypeCoder

    • Constructor Detail

      • BigEndianDatatypeCoder

        public BigEndianDatatypeCoder​(IEncodingFactory encodingFactory)
        Creates a big-endian datatype coder for native access on big-endian platforms.

        In almost all cases, it is better to use forEncodingFactory(IEncodingFactory).

        Parameters:
        encodingFactory - Encoding factory
    • Method Detail

      • forEncodingFactory

        public static BigEndianDatatypeCoder forEncodingFactory​(IEncodingFactory encodingFactory)
        Returns an instance of BigEndianDatatypeCoder for an encoding factory.
        Parameters:
        encodingFactory - Encoding factory
        Returns:
        Datatype coder, this might be a cached instance
      • encodeShort

        public void encodeShort​(int value,
                                byte[] target,
                                int fromIndex)
        Description copied from interface: DatatypeCoder
        Encode a short value into the target byte array starting at index fromIndex.
        Specified by:
        encodeShort in interface DatatypeCoder
        Overrides:
        encodeShort in class DefaultDatatypeCoder
        Parameters:
        value - The value to be encoded
        target - Target byte array of sufficient size (warning: this may be datatype coder specific)
        fromIndex - Index to start writing
      • decodeShort

        public short decodeShort​(byte[] byte_int)
        Description copied from interface: DatatypeCoder
        Decode a byte array into a short value.
        Specified by:
        decodeShort in interface DatatypeCoder
        Overrides:
        decodeShort in class DefaultDatatypeCoder
        Parameters:
        byte_int - The byte array to be decoded
        Returns:
        The short value of the decoded byte array
      • decodeShort

        public short decodeShort​(byte[] bytes,
                                 int fromIndex)
        Description copied from interface: DatatypeCoder
        Decode from a byte array to a short value.
        Specified by:
        decodeShort in interface DatatypeCoder
        Overrides:
        decodeShort in class DefaultDatatypeCoder
        Parameters:
        bytes - The byte array to be decoded
        fromIndex - The index to start reading
        Returns:
        The short value of the decoded byte array