Package rasj.clientcommhttp
Class RasUtils
java.lang.Object
rasj.clientcommhttp.RasUtils
- All Implemented Interfaces:
RasCommDefs
This class provides some useful methods for reading binary data from a stream
or converting objects to a byte array for transmission.
-
Field Summary
Fields inherited from interface rasj.clientcommhttp.RasCommDefs
BIG_ENDIAN, BROWSER, LITTLE_ENDIAN, RASCLIENT, RESPONSE_ERROR, RESPONSE_INT, RESPONSE_MDDS, RESPONSE_OID, RESPONSE_OK, RESPONSE_OK_NEGATIVE, RESPONSE_SKALARS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringReads characters from a stream until a '\0' character is reached.static intubytesToInt(byte[] uBytes, byte endianess) This method is used for turning up to 4 unsigned bytes into signed integers.static longubytesToLong(byte[] uBytes, byte endianess) This method is used for turning up to 8 unsigned bytes into signed integers.
-
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 Integerendianess- 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 Integerendianess- determines the order of the bytes: 0 = bigendian, 1 = little endian
-
readString
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
-