code: public void write(final byte[] b, final int off, final int len)
        throws IOException {
      // find the line breaks and pass other chars through in blocks
      int offset = off;
      int blockStartOffset = offset;
      int remaining = len;
      while (remaining > 0) {
        while (remaining > 0 && b[offset] != LF && b[offset] != CR) {
          offset++;
          remaining--;
        }
        // either end of buffer or a line separator char
        int blockLength = offset - blockStartOffset;
        if (blockLength > 0) {
          buffer.write(b, blockStartOffset, blockLength);
          lastReceivedByte = 0;
        }
        while (remaining > 0 && (b[offset] == LF || b[offset] == CR)) {
          write(b[offset]);
          offset++;
          remaining--;
        }
        blockStartOffset = offset;
      }
    }
docs: Write a block of characters to the output stream
  
  @param b the array containing the data
  @param off the offset into the array where data starts
  @param len the length of block
  @throws java.io.IOException if the data cannot be written into the stream.
  @see java.io.OutputStream#write(byte[], int, int)