Allowing .setPayload() with byte arrays in BaseFrame

This commit is contained in:
Joakim Erdfelt 2012-07-06 09:44:49 -07:00
parent 89d6e8ddbf
commit 9129130a0b
1 changed files with 15 additions and 1 deletions

View File

@ -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.
*