publicclass ReadUByte { /** Guaranteed to return a value that is out-of-spec for read(). */ staticclass BrokenInputStream extends ByteArrayInputStream {
BrokenInputStream() { super(newbyte[16]);
}
publicint read() { return -33;
}
}
publicstaticvoid realMain(String[] args) throws Throwable { try { new GZIPInputStream(new BrokenInputStream());
fail("Failed to throw expected IOException");
} catch (IOException ex) {
String msg = ex.getMessage(); if (msg.indexOf("ReadUByte$BrokenInputStream.read() returned value out of range") < 0) {
fail("IOException contains incorrect message: '" + msg + "'");
}
}
}
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.