Java ByteBuffer Decode decode(Charset charset, ByteBuffer buffer)

Here you can find the source of decode(Charset charset, ByteBuffer buffer)

Description

decode

License

Apache License

Declaration

public static String decode(Charset charset, ByteBuffer buffer) 

Method Source Code


//package com.java2s;
/*// ww w  .ja v  a2s  .  c om
 * Copyright 2015-2017 GenerallyCloud.com
 *  
 * 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 String decode(Charset charset, ByteBuffer buffer) {

        CharBuffer cb = charset.decode(buffer);

        return cb.toString();
    }
}

Related

  1. bytesToChars(CharsetDecoder decoder, ByteBuffer bytes, CharBuffer chars)
  2. decode(byte firstByte, ByteBuffer buffer, String charset)
  3. decode(ByteBuffer bb)
  4. decode(ByteBuffer bb, CharsetDecoder decoder)
  5. decode(CharsetDecoder decoder, ByteBuffer src, CharBuffer dst)
  6. decode(String charsetName, ByteBuffer byteBuffer)
  7. decodeAlign(ByteBuffer buf)
  8. decodeASCII(ByteBuffer buffer, int length, int offset)