public void appendPacket(Buffer otherBuffer){
  byte[] newBuffer=new byte[limit - position + otherBuffer.limit];
  System.arraycopy(buf,position,newBuffer,0,remaining());
  System.arraycopy(otherBuffer.buf,0,newBuffer,limit - position,otherBuffer.limit);
  buf=newBuffer;
  limit=limit - position + otherBuffer.limit;
  position=0;
}

public void appendPacket ( Buffer otherBuffer ) { byte [ ] newBuffer = new byte [ limit - position + otherBuffer . limit ] ; System . arraycopy ( buf , position , newBuffer , 0 , remaining ( ) ) ; System . arraycopy ( otherBuffer . buf , 0 , newBuffer , limit - position , otherBuffer . limit ) ; buf = newBuffer ; limit = limit - position + otherBuffer . limit ; position = 0 ; }
add stream to bytebuffer .
