public abstract class DOFPacket
extends java.lang.Object
implements java.io.Serializable
Constructor and Description |
---|
DOFPacket() |
Modifier and Type | Method and Description |
---|---|
static DOFPacket |
create()
Constructs a DOFPacket instance with no contents.
|
static DOFPacket |
create(byte[] array)
Constructs a DOFPacket instance from a source byte array.
|
static DOFPacket |
create(byte[] array,
int length)
Constructs a DOFPacket instance from a portion of a source byte array starting at offset 0.
|
static DOFPacket |
create(byte[] array,
int offset,
int length)
Constructs a DOFPacket instance from a portion of a source byte array.
|
byte[] |
getBytes()
Get a byte array containing a copy of the bytes in the packet.
|
int |
length()
Get the length of the packet, in bytes.
|
void |
putBytes(byte[] array,
int offset,
int length)
Copies a portion of a byte array to the packet.
|
public static DOFPacket create()
putBytes(byte[], int, int)
to add to the packet.public static DOFPacket create(byte[] array)
array
- The source byte array which will be copied to the packet. This may be null, in which case an empty
packet will be created.public static DOFPacket create(byte[] array, int length)
array
- The source byte array, from which bytes will be copied to the packet. This may be null, in which case the other argument is ignored
and an empty packet is created.length
- The number of bytes to copy from array to the packet. If array is not null then this must not be negative and must lie within the array.public static DOFPacket create(byte[] array, int offset, int length)
array
- The source byte array, from which bytes will be copied to the packet. This may be null, in which case the other arguments are ignored.offset
- The offset into the array, at which to start copying bytes to the packet. If array is not null then this must not be negative and must lie within the array.length
- The number of bytes to copy from array to the packet. If array is not null then this must not be negative and must lie within the array.public byte[] getBytes()
public int length()
public void putBytes(byte[] array, int offset, int length)
array
- The source byte array, from which bytes will be copied to the packet.offset
- The offset into array, from which to start copying bytes to the packet.length
- The number of bytes to copy from array to the packet.