Java ByteBuffer Get getCRLFLine(ByteBuffer buf)

Here you can find the source of getCRLFLine(ByteBuffer buf)

Description

get CRLF Line

License

Open Source License

Declaration

public static String getCRLFLine(ByteBuffer buf) 

Method Source Code


//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
    }
}

Related

  1. getChars(ByteBuffer buf, int off, int count)
  2. getCPCharacter(ByteBuffer buffer)
  3. getCrcChecksum(ByteBuffer buffer)
  4. getCRLFCRLFIndex(ByteBuffer buffer)
  5. getCRLFIndex(ByteBuffer buffer)
  6. getData(ByteBuffer buf, int index, int size)
  7. getDataFromBuffer(ByteBuffer b)
  8. getDirectByteBuffer(ByteBuffer var0, boolean var1)
  9. getDouble(ByteBuffer buffer)