private int next ( final byte [ ] buffer , final int offset , final int length ) throws IOException { final int max = Math . min ( length , this . input . remaining ( ) ) ; this . input . put ( buffer , offset , max ) ; this . input . flip ( ) ; while ( true ) { final CoderResult result = this . decoder . decode ( this . input , this . output , false ) ; if ( result . isError ( ) ) { result . throwException ( ) ; } this . writer . write ( this . output . array ( ) , 0 , this . output . position ( ) ) ; this . writer . flush ( ) ; this . output . rewind ( ) ; if ( result . isUnderflow ( ) ) { break ; } } this . input . compact ( ) ; return max ; }
Write a portion from the buffer .