String str ="内容";
ByteBuffer bb = ByteBuffer.wrap( str.getBytes() );
/*
这语句简单,今后地球人都知道。在哪里最有用?-----
当你通过 nio 与 SocketChannel 编写网络服务器,你可能经常需要将字符串发往客户端,然而 SocketChannel.write 方法却需要一个 ByteBuffer 作为参数。
*/
String str ="内容";
ByteBuffer bb = ByteBuffer.wrap( str.getBytes() );
/*
这语句简单,今后地球人都知道。在哪里最有用?-----
当你通过 nio 与 SocketChannel 编写网络服务器,你可能经常需要将字符串发往客户端,然而 SocketChannel.write 方法却需要一个 ByteBuffer 作为参数。
*/