equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
31 import java.io.ByteArrayInputStream; |
31 import java.io.ByteArrayInputStream; |
32 import java.io.File; |
32 import java.io.File; |
33 import java.io.IOException; |
33 import java.io.IOException; |
34 import java.io.InputStream; |
34 import java.io.InputStream; |
35 import java.io.OutputStream; |
35 import java.io.OutputStream; |
|
36 import java.nio.file.Files; |
|
37 import java.nio.file.Paths; |
|
38 |
36 import javax.sound.sampled.AudioFileFormat; |
39 import javax.sound.sampled.AudioFileFormat; |
37 import javax.sound.sampled.AudioFormat; |
40 import javax.sound.sampled.AudioFormat; |
38 import javax.sound.sampled.AudioInputStream; |
41 import javax.sound.sampled.AudioInputStream; |
39 import javax.sound.sampled.AudioSystem; |
42 import javax.sound.sampled.AudioSystem; |
40 |
43 |
87 |
90 |
88 try { |
91 try { |
89 if (isFile) { |
92 if (isFile) { |
90 File f = File.createTempFile("WriterCloseInput" + testTotal, "tmp"); |
93 File f = File.createTempFile("WriterCloseInput" + testTotal, "tmp"); |
91 AudioSystem.write(inStream, fileType, f); |
94 AudioSystem.write(inStream, fileType, f); |
92 f.delete(); |
95 Files.delete(Paths.get(f.getAbsolutePath())); |
93 } else { |
96 } else { |
94 OutputStream outStream = new NullOutputStream(); |
97 OutputStream outStream = new NullOutputStream(); |
95 AudioSystem.write(inStream, fileType, outStream); |
98 AudioSystem.write(inStream, fileType, outStream); |
96 } |
99 } |
97 } catch (Exception ex) { |
100 } catch (Exception ex) { |