Class RasUtils

  • All Implemented Interfaces:
    RasCommDefs

    public final class RasUtils
    extends java.lang.Object
    implements RasCommDefs
    This class provides some useful methods for reading binary data from a stream or converting objects to a byte array for transmission.
    • Constructor Detail

      • RasUtils

        public RasUtils()
    • Method Detail

      • ubytesToInt

        public static int ubytesToInt​(byte[] uBytes,
                                      byte endianess)
        This method is used for turning up to 4 unsigned bytes into signed integers.
        Parameters:
        uBytes - one to four Bytes which are interpreted as an unsigned Integer
        endianess - determines the order of the bytes: 0 = bigendian, 1 = little endian
      • ubytesToLong

        public static long ubytesToLong​(byte[] uBytes,
                                        byte endianess)
        This method is used for turning up to 8 unsigned bytes into signed integers.
        Parameters:
        uBytes - one to eight Bytes which are interpreted as an unsigned Integer
        endianess - determines the order of the bytes: 0 = bigendian, 1 = little endian
      • readString

        public static java.lang.String readString​(java.io.InputStream in)
                                           throws java.io.IOException
        Reads characters from a stream until a '\0' character is reached.
        Parameters:
        in - BufferedInputStream to be read from ( must have been initialized before! )
        Throws:
        java.io.IOException