< prev index next >

test/javax/sound/sampled/spi/AudioFileWriter/WriterCloseInput.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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.

@@ -31,10 +31,13 @@
 import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
 import javax.sound.sampled.AudioFileFormat;
 import javax.sound.sampled.AudioFormat;
 import javax.sound.sampled.AudioInputStream;
 import javax.sound.sampled.AudioSystem;
 

@@ -87,11 +90,11 @@
 
         try {
             if (isFile) {
                 File f = File.createTempFile("WriterCloseInput" + testTotal, "tmp");
                 AudioSystem.write(inStream, fileType, f);
-                f.delete();
+                Files.delete(Paths.get(f.getAbsolutePath()));
             } else {
                 OutputStream outStream = new NullOutputStream();
                 AudioSystem.write(inStream, fileType, outStream);
             }
         } catch (Exception ex) {
< prev index next >