Java ByteBuffer Put toByteBuffer(String input)

Here you can find the source of toByteBuffer(String input)

Description

to Byte Buffer

License

Apache License

Declaration

public static ByteBuffer toByteBuffer(String input) 

Method Source Code

//package com.java2s;
/*//from  w  w w  . j  a va2  s  . c om
 *              bitlet - Simple bittorrent library
 *  Copyright (C) 2008 Alessandro Bahgat Shehata, Daniele Castagna
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;

public class Main {
    public static ByteBuffer toByteBuffer(String input) {
        return ByteBuffer.wrap(input.getBytes(StandardCharsets.UTF_8));
    }
}

Related

  1. serializeObject(Object obj, ByteBuffer buffer, ByteArrayOutputStream baos, boolean markEndOfHeader)
  2. setBit(ByteBuffer input, int pos)
  3. skipBlank(ByteBuffer input)
  4. toByteArrayInputStream(ByteBuffer buffer)
  5. toByteBuffer(InputStream inputStream)
  6. wrap(ByteBuffer byteBuffer, ByteBuffer outputBB, SSLEngine sslEngine)
  7. write(ByteBuffer buffer, DataOutput out)
  8. write(ByteBuffer byteBuffer, OutputStream outputStream)
  9. writeByteBufferList(List list, DataOutputStream os)