Package rasj.clientcommhttp
Class RasUtils
- java.lang.Object
-
- rasj.clientcommhttp.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.
-
-
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 Constructor Description RasUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringreadString(java.io.InputStream in)Reads 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.
-
-
-
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 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
public static java.lang.String readString(java.io.InputStream in) throws java.io.IOExceptionReads 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
-
-