Here you can find the source of getStringA(ByteBuffer byteBuffer, int length)
private static String getStringA(ByteBuffer byteBuffer, int length)
//package com.java2s; /*// w w w .j ava 2s . c o m * COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Notice * * The contents of this file are subject to the COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) * Version 1.0 (the "License"); you may not use this file except in * compliance with the License. A copy of the License is available at * http://www.opensource.org/licenses/cddl1.txt * * The Original Code is Drombler.org. The Initial Developer of the * Original Code is Florian Brunner (Sourceforge.net user: puce). * Copyright 2014 Drombler.org. All Rights Reserved. * * Contributor(s): . */ import java.nio.ByteBuffer; public class Main { private static String getStringA(ByteBuffer byteBuffer, int length) { byte[] dst = getBytes(byteBuffer, length); return new String(dst); } private static byte[] getBytes(ByteBuffer byteBuffer, int length) { byte[] dst = new byte[length]; byteBuffer.get(dst); return dst; } }