Skip to content

Instantly share code, notes, and snippets.

@dekz
Created September 17, 2010 03:55
Show Gist options
  • Select an option

  • Save dekz/583659 to your computer and use it in GitHub Desktop.

Select an option

Save dekz/583659 to your computer and use it in GitHub Desktop.
//Medium files - write 9000000 bytes
bm.bench(new Runnable() {
public void run() {
try {
InputStream in = new BufferedInputStream(new FileInputStream("test"));
OutputStream out = new BufferedOutputStream(new FileOutputStream("out"));
int i;
byte[] buffer = new byte[1024];
while ((i = in.read(buffer, 0, 1024)) != -1) {
out.write(buffer, 0, i);
}
out.close();
in.close();
} catch (Exception e) {
e.printStackTrace();
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment