Here you can find the source of getNTString(ByteBuffer buffer)
public static String getNTString(ByteBuffer buffer)
//package com.java2s; //License from project: Open Source License import java.nio.ByteBuffer; public class Main { /**/* w w w.j av a 2s . c o m*/ * Parses next null-terminated string. */ public static String getNTString(ByteBuffer buffer) { StringBuilder result = new StringBuilder(); while (buffer.remaining() > 0) { char c = (char) buffer.get(); if (c == '\0') break; result.append(c); } return result.toString(); } }