Here you can find the source of readString(ByteBuffer buf, int length)
Parameter | Description |
---|---|
buf | Buffer |
length | Length of string |
public static String readString(ByteBuffer buf, int length)
//package com.java2s; //License from project: Open Source License import java.nio.ByteBuffer; public class Main { /**// w ww. j a v a 2 s . c om * Read string from ByteBuffer * @param buf Buffer * @param length Length of string * @return String */ public static String readString(ByteBuffer buf, int length) { byte[] buffer = new byte[length]; buf.get(buffer); return new String(buffer); } }