goja-core/src/main/java/goja/core/kits/stream/FastCharBuffer.java
public FastCharBuffer append(String string) {
        int len = string.length();
        if (len == 0) {
            return this;
        }

        int end = offset + len;
        int newSize = size + len;
        int remaining = len;
        int start = 0;

        if (currentBuffer != null) {
            // first try to fill current buffer
            int part = Math.min(remaining, currentBuffer.length - offset);
            string.getChars(0, part, currentBuffer, offset);
            remaining -= part;
            offset += part;
            size += part;
            start += 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);
            string.getChars(start, start + part, currentBuffer, offset);
            offset += part;
            size += part;
        }

        return this;
    }
public FastCharBuffer append(String string) {
        int len = string.length();
        if (len == 0) {
            return this;
        }

        int end = offset + len;
        int newSize = size + len;
        int remaining = len;
        int start = 0;

        if (currentBuffer != null) {
            // first try to fill current buffer
            int part = Math.min(remaining, currentBuffer.length - offset);
            string.getChars(0, part, currentBuffer, offset);
            remaining -= part;
            offset += part;
            size += part;
            start += 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);
            string.getChars(start, start + part, currentBuffer, offset);
            offset += part;
            size += part;
        }

        return this;
    }
public FastCharBuffer append ( String string ) { int len = string . length ( ) ; if ( len == 0 ) { return this ; } int end = offset + len ; int newSize = size + len ; int remaining = len ; int start = 0 ; if ( currentBuffer != null ) { // first try to fill current buffer int part = Math . min ( remaining , currentBuffer . length - offset ) ; string . getChars ( 0 , part , currentBuffer , offset ) ; remaining -= part ; offset += part ; size += part ; start += 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 ) ; string . getChars ( start , start + part , currentBuffer , offset ) ; offset += part ; size += part ; } return this ; }
Appends string content to buffer.
Appends string content to buffer .