< prev index next >
test/javax/sound/midi/Gervill/ModelByteBuffer/GetRoot.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, 2016, 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.
*** 26,35 ****
--- 26,37 ----
@modules java.desktop/com.sun.media.sound
*/
import java.io.File;
import java.io.FileOutputStream;
+ import java.nio.file.Files;
+ import java.nio.file.Paths;
import javax.sound.sampled.*;
import com.sun.media.sound.*;
*** 51,67 ****
testarray[i] *= 0.3;
}
test_byte_array = new byte[testarray.length*2];
AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array);
test_file = File.createTempFile("test", ".raw");
! FileOutputStream fos = new FileOutputStream(test_file);
fos.write(test_byte_array);
}
static void tearDown() throws Exception {
! if(!test_file.delete())
! test_file.deleteOnExit();
}
public static void main(String[] args) throws Exception {
try
{
--- 53,69 ----
testarray[i] *= 0.3;
}
test_byte_array = new byte[testarray.length*2];
AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array);
test_file = File.createTempFile("test", ".raw");
! try (FileOutputStream fos = new FileOutputStream(test_file)) {
fos.write(test_byte_array);
}
+ }
static void tearDown() throws Exception {
! Files.delete(Paths.get(test_file.getAbsolutePath()));
}
public static void main(String[] args) throws Exception {
try
{
< prev index next >