Class ByteHelperKt

  • All Implemented Interfaces:

    
    public final class ByteHelperKt
    
                        
    • Constructor Detail

    • Method Detail

      • getSIZES

         final FieldSizes getSIZES()

        Helper object that defines the fixed sizes of individual fields in the RSCP protocol.

      • getPOSITIONS

         final FieldPositions getPOSITIONS()

        Helper object that defines the fixed positions of the individual fields in a FrameHeader.

      • getTagsByHexString

         final Map<String, Tag> getTagsByHexString()

        Map containing all known tags. The key is the respective hex code as string in lowercase with leading prefix 0x

      • fromHexString

         final static ByteArray fromHexString(String $self)

        Creates a byte array from the string assuming that the string is in valid hex format.

        The call works for strings with and without prefix 0x. There is no validation if the string is a valid hex string.

        Returns:

        ByteArray representation of the hex string

        Since:

        2.0

      • crc32

         final static Long crc32(ByteArray $self)

        Calculates the CRC32 checksum of the ByteArray.

        Returns:

        Checksum of the ByteArray

        Since:

        2.0

      • fillCRC32forFrame

         final static ByteBuffer fillCRC32forFrame(ByteBuffer $self)

        Calculates the CRC32 checksum assuming that the byte buffer is an E3DC RSCP frame. This means that the checksum is formed over all bytes of the buffer, minus the last 4. See SIZES.

        Returns:

        ByteBuffer with filled checksum.

      • tagFromByteArray

         final static Tag tagFromByteArray(ByteArray byteArray)

        Returns the Tag for the given byteArray.

        If the tag is not known, an instance of UnknownTag is returned.

        Returns:

        Tag object to the given byteArray.

        Since:

        2.0