Java OutputStream Write copyFile(InputStream in, OutputStream out)

Here you can find the source of copyFile(InputStream in, OutputStream out)

Description

copy File

License

Apache License

Declaration

public static void copyFile(InputStream in, OutputStream out) throws IOException 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public class Main {

    public static void copyFile(InputStream in, OutputStream out) throws IOException {
        byte[] buffer = new byte[10240];
        int len;// ww  w .  j  a va  2  s . c om

        while ((len = in.read(buffer)) >= 0) {
            out.write(buffer, 0, len);
        }
    }
}

Related

  1. copyBytesToFile(byte[] bytes, File outputFile)
  2. copyBytesToStream(ByteArrayOutputStream from, OutputStream to)
  3. copyBytesToStream(InputStream inputStream, OutputStream outputStream, int length)
  4. copyFile(File fromFile, File toFile)
  5. copyFile(final InputStream in, final OutputStream out, final int size)
  6. copyFile(InputStream in, OutputStream out, boolean close)
  7. copyFile(InputStream inputStream, OutputStream outputStream)
  8. copyFile(OutputStream os, InputStream is)
  9. copyFile(String fileName, String newFileName)