|
VLab Common 1.2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpl.psnc.vlab.remote.util.BytesConversion
public class BytesConversion
BytesConversion
class - helper class is used to decode or encode the
data which is sent between the application and the VLab System
Field Summary | |
---|---|
protected static int |
INT_SIZE
The size (in bytes) of the integer variable |
Constructor Summary | |
---|---|
BytesConversion()
|
Method Summary | |
---|---|
SessionValue |
convertToSessionValue(pl.psnc.vlab.remote.Dgram datagramOut)
Converts a stream of bytes to the SessionValue object. |
byte[] |
encodeShortMessage(ShortMessageValue shortMsg)
Encodes the ShortMessage struct into array of bytes: struct shortMessage { char buffer[256]; int len; }; |
ShortMessageValue |
getShortMessage(byte[] binaryData,
java.nio.ByteOrder byteOrder)
Decodes the ShortMessage struct: struct shortMessage { char buffer[256]; int len; }; |
java.lang.String |
getString(byte[] binaryData)
Decodes an array of byte to the string. |
boolean |
isSessionValidAnswer(pl.psnc.vlab.remote.Dgram datagramOut)
Converts a stream of bytes to boolean type struct isAppSessionValidAnswer { int isValid; //boolean is valid (0/1) }; |
byte[] |
toBytes(java.lang.String value,
int size)
Converts a string value into fixed size byte array. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static int INT_SIZE
Constructor Detail |
---|
public BytesConversion()
Method Detail |
---|
public SessionValue convertToSessionValue(pl.psnc.vlab.remote.Dgram datagramOut) throws VlabException
datagramOut
-
VlabException
public boolean isSessionValidAnswer(pl.psnc.vlab.remote.Dgram datagramOut) throws VlabException
datagramOut
-
true
session is valid false
otherwise
VlabException
public byte[] toBytes(java.lang.String value, int size)
value
- string value to be convertedsize
- the length of the result array
public byte[] encodeShortMessage(ShortMessageValue shortMsg)
shortMsg
-
public ShortMessageValue getShortMessage(byte[] binaryData, java.nio.ByteOrder byteOrder)
binaryData
- byte array, which represents the VLab shortMessage
structure (The structure was presented in the method
description)
public java.lang.String getString(byte[] binaryData)
binaryData
- encoded string as an byte array
|
VLab Common 1.2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |