Allowing .setPayload() with byte arrays in BaseFrame
This commit is contained in:
parent
89d6e8ddbf
commit
9129130a0b
|
@ -179,7 +179,7 @@ public class BaseFrame implements Frame
|
|||
* @param buf
|
||||
* the bytebuffer to set
|
||||
*/
|
||||
protected void setPayload(byte buf[])
|
||||
public void setPayload(byte buf[])
|
||||
{
|
||||
int len = buf.length;
|
||||
this.payload = ByteBuffer.allocate(len);
|
||||
|
@ -188,6 +188,20 @@ public class BaseFrame implements Frame
|
|||
this.setPayloadLength(len);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the data and payload length.
|
||||
*
|
||||
* @param buf
|
||||
* the bytebuffer to set
|
||||
*/
|
||||
public void setPayload(byte buf[], int offset, int len)
|
||||
{
|
||||
this.payload = ByteBuffer.allocate(len);
|
||||
this.payload.put(buf,offset,len);
|
||||
this.payload.flip(); // make payload readable
|
||||
this.setPayloadLength(len);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the data and payload length.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue