Here you can find the source of asByteBuffer(String data)
public static ByteBuffer asByteBuffer(String data)
//package com.java2s; /*/*ww w. jav a 2 s . co m*/ * WireSpider * * Copyright (c) 2015 kazyx * * This software is released under the MIT License. * http://opensource.org/licenses/mit-license.php */ import java.io.UnsupportedEncodingException; import java.nio.ByteBuffer; public class Main { public static ByteBuffer asByteBuffer(String data) { try { return ByteBuffer.wrap(data.getBytes("UTF-8")); } catch (UnsupportedEncodingException e) { throw new UnsupportedOperationException(e); } } }