Here you can find the source of getCRLFLine(ByteBuffer buf)
public static String getCRLFLine(ByteBuffer buf)
//package com.java2s; //License from project: Open Source License import java.nio.ByteBuffer; public class Main { public static String getCRLFLine(ByteBuffer buf) { StringBuilder str = new StringBuilder(); byte b;//from w w w .ja v a 2 s .c om while (buf.hasRemaining()) { b = buf.get(); if (b == '\r' && buf.get() == '\n') { return str.toString(); } str.append((char) b); } return null; // we haven't found \r\n } }