private static int readMultiBytes(ByteBuffer input, int start, int len) { // We have already read one byte. if ( input.remaining() < (len-1) ) exception("Premature end to UTF-8 sequence at end of input") ; int x = start ; for ( int i = 0 ; i < len-1 ; i++ ) { int x2 = input.get() ; if ( (x2 & 0xC0) != 0x80 ) exception("Illegal UTF-8 processing character: 0x%04X",x2) ; // 6 bits of x2 x = (x << 6) | (x2 & 0x3F); } return x ; }
private static int readMultiBytes(ByteBuffer input, int start, int len) { // We have already read one byte. if ( input.remaining() < (len-1) ) exception("Premature end to UTF-8 sequence at end of input") ; int x = start ; for ( int i = 0 ; i < len-1 ; i++ ) { int x2 = input.get() ; if ( (x2 & 0xC0) != 0x80 ) exception("Illegal UTF-8 processing character: 0x%04X",x2) ; // 6 bits of x2 x = (x << 6) | (x2 & 0x3F); } return x ; }
private static int readMultiBytes(ByteBuffer input, int start, int len) { // We have already read one byte. if ( input.remaining() < (len-1) ) exception("Premature end to UTF-8 sequence at end of input") ; int x = start ; for ( int i = 0 ; i < len-1 ; i++ ) { int x2 = input.get() ; if ( (x2 & 0xC0) != 0x80 ) exception("Illegal UTF-8 processing character: 0x%04X",x2) ; // 6 bits of x2 x = (x << 6) | (x2 & 0x3F); } return x ; }