public int decode ( char [ ] chars , int pos , int len , MutableBoolean interrupt , int min ) throws IOException , CancelException { if ( min > len ) min = len ; int nb = 0 ; do { if ( currentBuffer == null ) { if ( nextBuffer . isUnblocked ( ) ) currentBuffer = nextBuffer . blockResult ( 0 ) ; else return nb > 0 ? nb : - 2 ; if ( currentBuffer != null ) nextBuffer = io . readNextBufferAsync ( ) ; } int decoded = decode ( currentBuffer , chars , pos + nb , len - nb , interrupt , min - nb ) ; if ( decoded < 0 || ( decoded == 0 && currentBuffer == null ) ) return nb > 0 ? nb : - 1 ; nb += decoded ; if ( currentBuffer != null && ! currentBuffer . hasRemaining ( ) ) currentBuffer = null ; if ( nb == len ) return nb ; if ( nb >= min && interrupt . get ( ) ) return nb ; } while ( true ) ; }
Decode characters from the IO .