/** *VerifiesnewStringNoRepl()throwsaCharacterCodingException. *Themethodisinvokedby`Files.readString()`method.
*/
@Test publicvoid newStringNoReplTest() throws IOException { var f = Files.createTempFile(null, null); try (var fos = Files.newOutputStream(f)) {
fos.write(MALFORMED_UTF16); var read = Files.readString(f, UTF_16); thrownew RuntimeException("Exception should be thrown for a malformed input. Bytes read: " +
HexFormat.of()
.withPrefix("x")
.withUpperCase()
.formatHex(read.getBytes(UTF_16)));
} catch (CharacterCodingException cce) { // success
} finally {
Files.delete(f);
}
}
/** *VerifiesgetBytesNoRepl()throwsaCharacterCodingException. *Themethodisinvokedby`Files.writeString()`method.
*/
@Test publicvoid getBytesNoReplTest() throws IOException { var f = Files.createTempFile(null, null); try {
Files.writeString(f, MALFORMED_WINDOWS_1252, WINDOWS_1252); thrownew RuntimeException("Exception should be thrown");
} catch (CharacterCodingException cce) { // success
} finally {
Files.delete(f);
}
}
}
Messung V0.5 in Prozent
¤ 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.0.9Bemerkung:
(vorverarbeitet am 2026-06-10)
¤
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.