public void write()

in src/main/java/org/apache/sling/scripting/core/impl/bundled/LogWriter.java [69:99]


    public void write(char[] cbuf, int off, int len) {
        int i = off;
        for (int n = 0; n < len; n++, i++) {
            char c = cbuf[i];

            // if CR/LF flush the line
            if (c == '\n' || c == '\r') {

                // append upto the CR/LF
                int subLen = i - off;
                if (subLen > 0) {
                    synchronized (lineBuffer) {
                        lineBuffer.append(cbuf, off, subLen);
                    }
                }

                // and flush
                flush();

                // new offset is after the CR/LF
                off = i + 1;
            }
        }

        // remaining data in the buffer is just appended
        if (off < i) {
            synchronized (lineBuffer) {
                lineBuffer.append(cbuf, off, i - off);
            }
        }
    }