publicstaticvoid main(String args[]) throws Exception { // This conversion is pathologically bad - it is attempting to // read unicode from an ascii encoded string. // The orignal bug: A internal error in ISR results if the // byte counter in ByteToCharUnicode // is not advanced as the input is consumed.
try{
String s = "\n"; byte ss[] = null;
String sstring = "x";
ss = s.getBytes();
ByteArrayInputStream BAIS = new ByteArrayInputStream(ss);
InputStreamReader ISR = new InputStreamReader(BAIS, "Unicode");
BufferedReader BR = new BufferedReader(ISR);
sstring = BR.readLine();
BR.close();
System.out.println(sstring);
} catch (MalformedInputException e){ // Right error return;
} catch (java.lang.InternalError e) { thrownew Exception("ByteToCharUnicode is failing incorrectly for "
+ " single byte input");
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.