core/src/main/java/org/owasp/encoder/ChainedEncoder.java
@Override
    public CoderResult encode(CharBuffer input, CharBuffer output, boolean endOfInput) {
        for (;;) {
            CoderResult cr1 = _first.encode(input, _buffer, endOfInput);
            _buffer.flip();
            CoderResult cr2 = _last.encode(_buffer, output, endOfInput && cr1.isUnderflow());
            _buffer.compact();

            if (cr2.isOverflow()) {
                // no more room in output, even if we still have buffered input.
                return cr2;
            }

            if (cr1.isUnderflow()) {
                // we've consumed everything from input
                return cr2;
            }
        }
    }
@Override
    public CoderResult encode(CharBuffer input, CharBuffer output, boolean endOfInput) {
        for (;;) {
            CoderResult cr1 = _first.encode(input, _buffer, endOfInput);
            _buffer.flip();
            CoderResult cr2 = _last.encode(_buffer, output, endOfInput && cr1.isUnderflow());
            _buffer.compact();

            if (cr2.isOverflow()) {
                // no more room in output, even if we still have buffered input.
                return cr2;
            }

            if (cr1.isUnderflow()) {
                // we've consumed everything from input
                return cr2;
            }
        }
    }
@ Override public CoderResult encode ( CharBuffer input , CharBuffer output , boolean endOfInput ) { for ( ; ; ) { CoderResult cr1 = _first . encode ( input , _buffer , endOfInput ) ; _buffer . flip ( ) ; CoderResult cr2 = _last . encode ( _buffer , output , endOfInput && cr1 . isUnderflow ( ) ) ; _buffer . compact ( ) ; if ( cr2 . isOverflow ( ) ) { // no more room in output, even if we still have buffered input. return cr2 ; } if ( cr1 . isUnderflow ( ) ) { // we've consumed everything from input return cr2 ; } } }
}
}