public class DateTimePrintException extends DateTimeException
This will be triggered by violations specific to printing or an IO exception.
| Constructor and Description |
|---|
DateTimePrintException(String message)
Constructs a new exception with the specified message.
|
DateTimePrintException(String message,
Throwable cause)
Constructs a new exception with the specified message and cause.
|
| Modifier and Type | Method and Description |
|---|---|
void |
rethrowIOException()
Checks if the cause of this exception was an IOException, and if so
re-throws it
|
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringpublic DateTimePrintException(String message)
message - the message to use for this exception, may be nullpublic DateTimePrintException(String message, Throwable cause)
message - the message to use for this exception, may be nullcause - the cause of the exception, may be nullpublic void rethrowIOException() throws IOException
This method is useful if you call a printer with an open stream or writer and want to ensure that IOExceptions are not lost.
try {
printer.print(writer, dateTime);
} catch (DateTimePrintException ex) {
ex.rethrowIOException();
// if code reaches here exception was caused by date-time issues
}
Note that calling this method will re-throw the original IOException,
causing this DateTimePrintException to be lost.IOException - if the cause of this exception is an IOExceptionCopyright © 2007-2013 ThreeTen.org. All Rights Reserved.