Skip to content

Instantly share code, notes, and snippets.

@matteopic
Created February 27, 2020 12:16
Show Gist options
  • Save matteopic/707821a4cbe49981438901f058e87137 to your computer and use it in GitHub Desktop.
Save matteopic/707821a4cbe49981438901f058e87137 to your computer and use it in GitHub Desktop.
Utilities for java.io
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
public class IOUtils {
public static void copyStream(InputStream is, OutputStream os) throws IOException {
byte[] buffer = new byte[512];
int read;
while((read = is.read(buffer) )> 0){
os.write(buffer, 0, read);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment