Java ByteBuffer Set charSequence2ByteBuffer(CharSequence cs, Charset charset)

Here you can find the source of charSequence2ByteBuffer(CharSequence cs, Charset charset)

Description

char Sequence Byte Buffer

License

Apache License

Declaration

public static ByteBuffer charSequence2ByteBuffer(CharSequence cs, Charset charset) 

Method Source Code


//package com.java2s;
/*//from w  w  w  . j a  va2 s .c o  m
 * Copyright 2011-2019 GatlingCorp (https://gatling.io)
 *
 * 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.CharBuffer;
import java.nio.charset.Charset;

public class Main {
    public static ByteBuffer charSequence2ByteBuffer(CharSequence cs, Charset charset) {
        return charset.encode(CharBuffer.wrap(cs));
    }
}

Related

  1. base64FormatOfBinarySet(Collection bs)
  2. blockCopy(ByteBuffer source, int srcOffset, byte[] dest, int destOffset, int count)
  3. byteBuffersToString(ByteBuffer[] bufs, Charset cs)
  4. byteIndexOf(ByteBuffer buffer, byte[] temp, int offset)
  5. c_memset(ByteBuffer b, int c_, int size)
  6. charstoUTF8Bytes(char[] srcBuf, int srcOffset, int srcLength, ByteBuffer dest, int destOffset)
  7. equals(final ByteBuffer keyValue, final int offset, final int keyLen, final byte[] otherKey)
  8. find(ByteBuffer buffer, int offset, byte searchKey)
  9. findCommonPrefix(ByteBuffer buffer, int offsetLeft, int offsetRight, int limit)