code: private static int findeol(byte b[], int pos, int len) {
      int end = pos + len;
      int i = pos;
      while (i < end) {
        if (b[i++] == '\n') {
          return i - pos;
        }
      }
      return -1;
    }
docs: Attempt to find the '\n' end of line marker as defined in the comment of
  the <code>readLine</code> method of <code>ServletInputStream</code>.
  
  @param b byte array to search.
  @param pos position in byte array to search from.
  @param len maximum number of bytes to search.
  
  @return the number of bytes including the \n, or -1 if none found.