Java ByteBuffer to String getStringWOLength(ByteBuffer bb)

Here you can find the source of getStringWOLength(ByteBuffer bb)

Description

get String WO Length

License

LGPL

Declaration

public static String getStringWOLength(ByteBuffer bb) 

Method Source Code


//package com.java2s;
//License from project: LGPL 

import java.nio.ByteBuffer;
import java.nio.charset.Charset;

public class Main {
    public static String getStringWOLength(ByteBuffer bb) {
        byte[] b = new byte[bb.limit()];
        bb.get(b);/*  w  w  w .ja  va  2  s .com*/
        return new String(b, Charset.forName("UTF-8"));
    }
}

Related

  1. getStringFromBuffer(ByteBuffer buffer, int length)
  2. getStringFromByteBuffer(ByteBuffer bb)
  3. getStringFromByteBuffer(ByteBuffer data)
  4. getStringRepresentation(ByteBuffer key)
  5. getStringTrimmed(ByteBuffer buffer, int size)
  6. readStr(ByteBuffer bb, int off, int len)
  7. readString(byte[] tmp, ByteBuffer in)
  8. readString(ByteBuffer b, char s[], int off, int len)
  9. readString(ByteBuffer bb)