question: public static String readCharacterSizedString ( InputStream stream ) throws IOException { StringBuilder result = new StringBuilder ( ) ; int strLen = readUINT16 ( stream ) ; int character = stream . read ( ) ; character |= stream . read ( ) << 8 ; do { if ( character != 0 ) { result . append ( ( char ) character ) ; character = stream . read ( ) ; character |= stream . read ( ) << 8 ; } } while ( character != 0 || ( result . length ( ) + 1 ) > strLen ) ; if ( strLen != ( result . length ( ) + 1 ) ) { throw new IllegalStateException ( "Invalid Data for current interpretation" ) ; } return result . toString ( ) ; }
target:  This method reads a UTF-16 String, which length is given on the number of characters it consists of. <br> The stream must be at the number of characters. This number contains the terminating zero character (UINT16).