< prev index next >

test/javax/sound/midi/Gervill/RiffReaderWriter/WriteOutputStream.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2007, 2015, 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) 2007, 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.
*** 27,40 **** */ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; ! import javax.sound.sampled.*; ! ! import com.sun.media.sound.*; public class WriteOutputStream { private static void assertEquals(Object a, Object b) throws Exception { --- 27,41 ---- */ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; + import java.nio.file.Files; + import java.nio.file.Paths; ! import com.sun.media.sound.RIFFReader; ! import com.sun.media.sound.RIFFWriter; public class WriteOutputStream { private static void assertEquals(Object a, Object b) throws Exception {
*** 61,81 **** RIFFReader readchunk = reader.nextChunk(); assertEquals(readchunk.getFormat(), "TSCH"); assertEquals(readchunk.read(), 33); fis.close(); reader = null; - - } finally { if(writer != null) writer.close(); if(reader != null) reader.close(); ! ! if(tempfile.exists()) ! if(!tempfile.delete()) ! tempfile.deleteOnExit(); } } } --- 62,77 ---- RIFFReader readchunk = reader.nextChunk(); assertEquals(readchunk.getFormat(), "TSCH"); assertEquals(readchunk.read(), 33); fis.close(); reader = null; } finally { if(writer != null) writer.close(); if(reader != null) reader.close(); ! Files.delete(Paths.get(tempfile.getAbsolutePath())); } } }
< prev index next >