Class RasUtils

java.lang.Object
rasj.clientcommhttp.RasUtils
All Implemented Interfaces:
RasCommDefs

public final class RasUtils extends 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 Details

    • RasUtils

      public RasUtils()
  • Method Details

    • 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 String readString(InputStream in) throws 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:
      IOException