Here you can find the source of getString(ByteBuffer buffer, int length)
Parameter | Description |
---|---|
buffer | a parameter |
length | a parameter |
public static String getString(ByteBuffer buffer, int length)
//package com.java2s; //License from project: Open Source License import java.nio.ByteBuffer; public class Main { /**/* w w w.j av a2 s. c om*/ * * @param buffer * @param length * @return */ public static String getString(ByteBuffer buffer, int length) { StringBuilder builder = new StringBuilder(); for (int i = 0; i < length; i++) { builder.append((char) buffer.get()); } return builder.toString(); } }