Here you can find the source of writeByteString(ByteBuffer byteBuffer, String value)
private static void writeByteString(ByteBuffer byteBuffer, String value)
//package com.java2s; //License from project: Open Source License import java.nio.ByteBuffer; public class Main { private static void writeByteString(ByteBuffer byteBuffer, String value) { byteBuffer.putInt(value.length()); byteBuffer.put(value.getBytes()); }//from w ww. j a v a 2s . co m }