public char [ ] readChars ( int length ) throws KryoException { char [ ] array = new char [ length ] ; if ( optional ( length << 1 ) == length << 1 ) { byte [ ] buffer = this . buffer ; int p = this . position ; for ( int i = 0 ; i < length ; i ++ , p += 2 ) array [ i ] = ( char ) ( ( buffer [ p ] & 0xFF ) | ( ( buffer [ p + 1 ] & 0xFF ) ) << 8 ) ; position = p ; } else { for ( int i = 0 ; i < length ; i ++ ) array [ i ] = readChar ( ) ; } return array ; }
Reads a char array in bulk . This may be more efficient than reading them individually .