Java ByteBuffer to UTF readUTFString(MappedByteBuffer mmap)

Here you can find the source of readUTFString(MappedByteBuffer mmap)

Description

read UTF String

License

Open Source License

Declaration

public static String readUTFString(MappedByteBuffer mmap) 

Method Source Code


//package com.java2s;

import java.nio.MappedByteBuffer;
import java.nio.charset.Charset;

public class Main {
    public static String readUTFString(MappedByteBuffer mmap) {
        byte[] encodedString = new byte[mmap.getShort()];
        mmap.get(encodedString);/*w ww  .j a  v a  2  s .co  m*/
        return new String(encodedString, Charset.forName("UTF-8"));
    }
}

Related

  1. readUTF(ByteBuffer bb)
  2. readUTF8(ByteBuffer buf)
  3. toUtf8CharBuffer(ByteBuffer buffer)
  4. toUtf8String(ByteBuffer buffer)
  5. toUTF8String(ByteBuffer buffer)
  6. toUtf8String(ByteBuffer byteBuffer)