< prev index next >

test/jdk/javax/imageio/plugins/shared/CanWriteSequence.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 44,53 **** --- 44,54 ---- */ public final class CanWriteSequence { private static File file; private static FileOutputStream fos; + private static ImageOutputStream ios; public static void main(final String[] args) throws Exception { final IIORegistry registry = IIORegistry.getDefaultInstance(); final Iterator<ImageWriterSpi> iter = registry.getServiceProviders(ImageWriterSpi.class,
*** 63,73 **** private static void test(final ImageWriter writer) throws Exception { try { file = File.createTempFile("temp", ".img"); fos = new FileOutputStream(file); ! final ImageOutputStream ios = ImageIO.createImageOutputStream(fos); writer.setOutput(ios); final IIOMetadata data = writer.getDefaultStreamMetadata(null); if (writer.canWriteSequence()) { writer.prepareWriteSequence(data); --- 64,74 ---- private static void test(final ImageWriter writer) throws Exception { try { file = File.createTempFile("temp", ".img"); fos = new FileOutputStream(file); ! ios = ImageIO.createImageOutputStream(fos); writer.setOutput(ios); final IIOMetadata data = writer.getDefaultStreamMetadata(null); if (writer.canWriteSequence()) { writer.prepareWriteSequence(data);
*** 81,94 **** } } } finally { writer.dispose(); if (file != null) { if (fos != null) { fos.close(); } Files.delete(file.toPath()); } } } } - --- 82,97 ---- } } } finally { writer.dispose(); if (file != null) { + if (ios != null) { + ios.close(); + } if (fos != null) { fos.close(); } Files.delete(file.toPath()); } } } } \ No newline at end of file
< prev index next >