goja-core/src/main/java/goja/core/kits/stream/FastCharBuffer.java
public FastCharBuffer append(char[] array, int off, int len) {
        int end = off + len;
        if ((off < 0)
                || (len < 0)
                || (end > array.length)) {
            throw new IndexOutOfBoundsException();
        }
        if (len == 0) {
            return this;
        }
        int newSize = size + len;
        int remaining = len;

        if (currentBuffer != null) {
            // first try to fill current buffer
            int part = Math.min(remaining, currentBuffer.length - offset);
            System.arraycopy(array, end - remaining, currentBuffer, offset, part);
            remaining -= part;
            offset += part;
            size += part;
        }

        if (remaining > 0) {
            // still some data left
            // ask for new buffer
            needNewBuffer(newSize);

            // then copy remaining
            // but this time we are sure that it will fit
            int part = Math.min(remaining, currentBuffer.length - offset);
            System.arraycopy(array, end - remaining, currentBuffer, offset, part);
            offset += part;
            size += part;
        }

        return this;
    }
public FastCharBuffer append(char[] array, int off, int len) {
        int end = off + len;
        if ((off < 0)
                || (len < 0)
                || (end > array.length)) {
            throw new IndexOutOfBoundsException();
        }
        if (len == 0) {
            return this;
        }
        int newSize = size + len;
        int remaining = len;

        if (currentBuffer != null) {
            // first try to fill current buffer
            int part = Math.min(remaining, currentBuffer.length - offset);
            System.arraycopy(array, end - remaining, currentBuffer, offset, part);
            remaining -= part;
            offset += part;
            size += part;
        }

        if (remaining > 0) {
            // still some data left
            // ask for new buffer
            needNewBuffer(newSize);

            // then copy remaining
            // but this time we are sure that it will fit
            int part = Math.min(remaining, currentBuffer.length - offset);
            System.arraycopy(array, end - remaining, currentBuffer, offset, part);
            offset += part;
            size += part;
        }

        return this;
    }
public FastCharBuffer append ( char [ ] array , int off , int len ) { int end = off + len ; if ( ( off < 0 ) || ( len < 0 ) || ( end > array . length ) ) { throw new IndexOutOfBoundsException ( ) ; } if ( len == 0 ) { return this ; } int newSize = size + len ; int remaining = len ; if ( currentBuffer != null ) { // first try to fill current buffer int part = Math . min ( remaining , currentBuffer . length - offset ) ; System . arraycopy ( array , end - remaining , currentBuffer , offset , part ) ; remaining -= part ; offset += part ; size += part ; } if ( remaining > 0 ) { // still some data left // ask for new buffer needNewBuffer ( newSize ) ; // then copy remaining // but this time we are sure that it will fit int part = Math . min ( remaining , currentBuffer . length - offset ) ; System . arraycopy ( array , end - remaining , currentBuffer , offset , part ) ; offset += part ; size += part ; } return this ; }
Appends <code>char</code> array to buffer.
Appends <code > char< / code > array to buffer .