private static void tryCatch(Buffer b, Class<?> ex, Runnable thunk) { boolean caught = false; try { thunk.run(); } catch (Throwable x) { if (ex.isAssignableFrom(x.getClass())) { caught = true; } else { fail(x.getMessage() + " not expected"); } } if (!caught) fail(ex.getName() + " not thrown", b); }
/** Does the <code>DataFlavor</code> represent a <code>java.io.InputStream</code>? */ public boolean isRepresentationClassInputStream() { return ioInputStreamClass.isAssignableFrom(representationClass); }