Here you can find the source of toStringUntil(byte[] b, int pos, byte until)
public static String toStringUntil(byte[] b, int pos, byte until)
//package com.java2s; public class Main { public static String toStringUntil(byte[] b, int pos, byte until) { StringBuilder str = new StringBuilder(); while (true) { if (b.length <= pos) { return null; }/*from w w w . j a va 2 s.c om*/ byte ch = b[pos]; if (ch == until) { break; } str.append((char) ch); pos++; } String ret = str.toString(); return ret; } }