if (reader instanceof ReaderWrapper) { childCopy = ((ReaderWrapper) reader).duplicateRecurse(imageReaderClass);
if (reader instanceof ReaderWrapper) { childCopy = ((ReaderWrapper) reader).duplicateRecurse(imageReaderClass);
/** * Performs a deep copy of the reader, including nested wrapped readers. * Most of the reader state is preserved as well, including:<ul> * <li>{@link #isNormalized()}</li> * <li>{@link #isMetadataFiltered()}</li> * <li>{@link DelegateReader#isLegacy()}</li> * </ul> * * @param imageReaderClass If non-null, any {@link ImageReader}s in the * reader stack will be replaced with instances of the given class. * @throws FormatException If something goes wrong during the duplication. */ public ReaderWrapper duplicate( Class<? extends IFormatReader> imageReaderClass) throws FormatException { ReaderWrapper wrapperCopy = duplicateRecurse(imageReaderClass); // sync top-level configuration with original reader boolean normalized = isNormalized(); boolean metadataFiltered = isMetadataFiltered(); wrapperCopy.setNormalized(normalized); wrapperCopy.setMetadataFiltered(metadataFiltered); return wrapperCopy; }
/** * Performs a deep copy of the reader, including nested wrapped readers. * Most of the reader state is preserved as well, including:<ul> * <li>{@link #isNormalized()}</li> * <li>{@link #isMetadataFiltered()}</li> * <li>{@link DelegateReader#isLegacy()}</li> * </ul> * * @param imageReaderClass If non-null, any {@link ImageReader}s in the * reader stack will be replaced with instances of the given class. * @throws FormatException If something goes wrong during the duplication. */ public ReaderWrapper duplicate( Class<? extends IFormatReader> imageReaderClass) throws FormatException { ReaderWrapper wrapperCopy = duplicateRecurse(imageReaderClass); // sync top-level configuration with original reader boolean normalized = isNormalized(); boolean metadataFiltered = isMetadataFiltered(); wrapperCopy.setNormalized(normalized); wrapperCopy.setMetadataFiltered(metadataFiltered); return wrapperCopy; }