org.avineas.fins.payload
public class Payload extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
MAXPAYLOADSIZE |
Modifier and Type | Method and Description |
---|---|
static int |
decode(byte[] from,
int offset,
int length)
Counterpart of the encode method that decodes an integer from a byte array
|
static void |
encode(int value,
byte[] to,
int offset,
int length)
Encode an integer into a byte array using FINS conventions.
|
byte[] |
getBytes()
Bytes variant that creates a new byte array.
|
int |
getBytes(byte[] out,
int offset,
int size)
Get this payload as a byte array which can be simply included in a
FINS frame
|
int |
getMrc() |
java.lang.String |
getRequestCode() |
int |
getSrc() |
void |
setMrc(int mrc) |
void |
setRequestCode(int command) |
void |
setRequestCode(int mrc,
int src)
A request code consists of a main request code and a sub request code.
|
void |
setSrc(int src) |
public static final int MAXPAYLOADSIZE
public void setRequestCode(int command)
public void setRequestCode(int mrc, int src)
mrc
- The main request codesrc
- The sub request codepublic java.lang.String getRequestCode()
public int getMrc()
public int getSrc()
public void setMrc(int mrc)
public void setSrc(int src)
public int getBytes(byte[] out, int offset, int size)
out
- The buffer where the data is copied tooffset
- The offset to start copyingsize
- The size to copypublic byte[] getBytes()
public static void encode(int value, byte[] to, int offset, int length)
value
- The value to encodeto
- The buffer to encode tooffset
- The offset in the buffer to start the copyinglength
- The length to copy, the value is encoded using this amount
of bytespublic static int decode(byte[] from, int offset, int length)
from
- The byte array to decode fromoffset
- The offset in the byte array to start the actionlength
- The length to decode