Permalink
Browse files

Added buffering to temp file writing.

  • Loading branch information...
1 parent 5122fac commit fb8330bcb5263826cec33ca076ea59962ccf9a0b @finnkuusisto committed Aug 13, 2012
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/kuusisto/tinysound/TinySound.java
  2. BIN tinysound.zip
@@ -26,6 +26,7 @@
*/
package kuusisto.tinysound;
+import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileNotFoundException;
@@ -290,8 +291,6 @@ public static Music loadMusic(URL url, boolean streamFromFile) {
if (info == null) {
return null;
}
- System.out.println("stream info acquired");//XXX
- System.out.println("creating music object"); //XXX
return new StreamMusic(info.URL, info.NUM_BYTES_PER_CHANNEL,
TinySound.mixer);
}
@@ -730,7 +729,8 @@ private static StreamInfo createFileStream(byte[][] data) {
//we have the file, now we want to be able to write to it
OutputStream out = null;
try {
- out = new FileOutputStream(temp);
+ out = new BufferedOutputStream(new FileOutputStream(temp),
+ (512 * 1024)); //buffer 512kb
} catch (FileNotFoundException e) {
System.err.println("Failed to open stream file for writing!");
return null;
View
Binary file not shown.

0 comments on commit fb8330b

Please sign in to comment.