@Override public Class[] getInputTypes() { return delegateProvider.getInputTypes(); } }
/** This method set the input only if the input object is a File. */ @Override public void setInput(Object input, boolean seekForwardOnly, boolean ignoreMetadata) { if (input != null) { boolean found = false; if (originatingProvider != null) { Class<?>[] classes = originatingProvider.getInputTypes(); for (int i = 0; i < classes.length; i++) { if (classes[i].isInstance(input)) { found = true; break; } } } else { if (input instanceof ImageInputStream) { found = true; } } if (!found) { throw new IllegalArgumentException("Incorrect input type!"); } this.seekForwardOnly = seekForwardOnly; this.ignoreMetadata = ignoreMetadata; this.minIndex = 0; } if (input instanceof File) { this.input = input; } }
@Test public void getInputTypes() { assertNotNull(spi.getInputTypes()); } }
@Override public Class[] getInputTypes() { return delegateProvider.getInputTypes(); } }
/** * Returns {@code true} if the given reader provider supports the given input type. If the * given provider is {@code null}, then this method conservatively assumes that the type is * supported on the assumption that the user provided an incomplete {@link ImageReader} * implementation, but his reader input type is consistent with his writer output type. * * @see #closeAndRead(ByteArrayOutputStream) */ private static boolean isSupportedInput(final ImageReaderSpi spi, final Class<?> type) { if (spi == null) { return true; } for (final Class<?> supportedType : spi.getInputTypes()) { if (supportedType.isAssignableFrom(type)) { return true; } } return false; }
@Test public void getInputTypes() { assertNotNull(spi.getInputTypes()); } }
final Class[] types = reader.getOriginatingProvider().getInputTypes(); if (contains(types, input.getClass())) { reader.setInput(input, seekForwardOnly);
/** * Validates the given provider of image readers. * First, this method verifies that mandatory elements are non-null, arrays are non-empty * (Image I/O specification requires them to be {@code null} rather than empty), and class * names are valid. Next, this method invokes {@link #validate(IIOMetadataFormat)} for each * metadata format (which can be null). * * @param provider the provider to validate, or {@code null} if none. */ public void validate(final ImageReaderSpi provider) { if (provider != null) { validateProvider(provider, ImageReader.class); final Class<?>[] inputTypes = provider.getInputTypes(); mandatory("ImageReaderSpi: shall have an inputTypes array.", inputTypes); validateArray("inputTypes", inputTypes); final String[] imageWriterSpiNames = provider.getImageWriterSpiNames(); validateArray("imageWriterSpiNames", imageWriterSpiNames); if (imageWriterSpiNames != null) { final ClassLoader loader = provider.getClass().getClassLoader(); for (int i=0; i<imageWriterSpiNames.length; i++) { final String field = "imageWriterSpiNames[" + i + ']'; final String className = imageWriterSpiNames[i]; assertNotNull(field + " can not be null.", className); validateClass(field, ImageWriterSpi.class, loader, className); } } } }