Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Server;
- import java.io.Closeable;
- import java.io.IOException;
- import java.io.InputStream;
- import java.io.OutputStream;
- public class FileUtils
- {
- private final static int BUFFER_SIZE = 16 * 1024;
- public static void copyStream(InputStream in, OutputStream out)
- throws IOException
- {
- try
- {
- byte [] buffer = new byte[BUFFER_SIZE];
- int count = -1;
- while ((count = in.read(buffer)) >= 0)
- {
- out.write(buffer, 0, count);
- }
- }
- finally
- {
- close(in);
- close(out);
- }
- }
- public static void close(Closeable obj)
- {
- try
- {
- obj.close();
- }
- catch (IOException e)
- {
- e.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement