/** * Tags any IOExceptions thrown, wrapping and re-throwing. * * @param e The IOException thrown * @throws IOException if an I/O error occurs */ @Override protected void handleIOException(IOException e) throws IOException { throw new TaggedIOException(e, tag); }
/** * Re-throws the original exception thrown by this stream. This method * first checks whether the given exception is a {@link TaggedIOException} * wrapper created by this decorator, and then unwraps and throws the * original wrapped exception. Returns normally if the exception was * not thrown by this stream. * * @param exception an exception * @throws IOException original exception, if any, thrown by this stream */ public void throwIfCauseOf(Exception exception) throws IOException { if (exception instanceof TaggedIOException) { TaggedIOException tagged = (TaggedIOException) exception; if (tag.equals(tagged.getTag())) { throw tagged.getCause(); } } }
/** * Tests if the given exception was caused by this stream. * * @param exception an exception * @return <code>true</code> if the exception was thrown by this stream, * <code>false</code> otherwise */ public boolean isCauseOf(IOException exception) { if (exception instanceof TaggedIOException) { TaggedIOException tagged = (TaggedIOException) exception; return tag.equals(tagged.getTag()); } else { return false; } }
/** * Tests if the given exception was caused by this stream. * * @param exception an exception * @return <code>true</code> if the exception was thrown by this stream, * <code>false</code> otherwise */ public boolean isCauseOf(IOException exception) { if (exception instanceof TaggedIOException) { TaggedIOException tagged = (TaggedIOException) exception; return tag.equals(tagged.getTag()); } else { return false; } }
/** * Re-throws the original exception thrown by this stream. This method * first checks whether the given exception is a {@link TaggedIOException} * wrapper created by this decorator, and then unwraps and throws the * original wrapped exception. Returns normally if the exception was * not thrown by this stream. * * @param exception an exception * @throws IOException original exception, if any, thrown by this stream */ public void throwIfCauseOf(Exception exception) throws IOException { if (exception instanceof TaggedIOException) { TaggedIOException tagged = (TaggedIOException) exception; if (tag.equals(tagged.getTag())) { throw tagged.getCause(); } } }
/** * Tags any IOExceptions thrown, wrapping and re-throwing. * * @param e The IOException thrown * @throws IOException if an I/O error occurs */ @Override protected void handleIOException(IOException e) throws IOException { throw new TaggedIOException(e, tag); }
/** * Tests if the given exception was caused by this stream. * * @param exception an exception * @return <code>true</code> if the exception was thrown by this stream, * <code>false</code> otherwise */ public boolean isCauseOf(IOException exception) { if (exception instanceof TaggedIOException) { TaggedIOException tagged = (TaggedIOException) exception; return tag.equals(tagged.getTag()); } else { return false; } }
/** * Re-throws the original exception thrown by this stream. This method * first checks whether the given exception is a {@link TaggedIOException} * wrapper created by this decorator, and then unwraps and throws the * original wrapped exception. Returns normally if the exception was * not thrown by this stream. * * @param exception an exception * @throws IOException original exception, if any, thrown by this stream */ public void throwIfCauseOf(Exception exception) throws IOException { if (exception instanceof TaggedIOException) { TaggedIOException tagged = (TaggedIOException) exception; if (tag.equals(tagged.getTag())) { throw tagged.getCause(); } } }
/** * Tags any IOExceptions thrown, wrapping and re-throwing. * * @param e The IOException thrown * @throws IOException if an I/O error occurs */ @Override protected void handleIOException(IOException e) throws IOException { throw new TaggedIOException(e, tag); }