public void writeToByteBuffer(ByteBuffer buffer) throws IOException {
  buffer.clear();
  writeToStream(new ByteBufferOutputStream(buffer));
}

public void writeToByteBuffer ( ByteBuffer buffer ) throws IOException { buffer . clear ( ) ; writeToStream ( new ByteBufferOutputStream ( buffer ) ) ; }
write this message to a buffer .
