Java InputStream Copy copyLarge(InputStream input, File outputFile)

Here you can find the source of copyLarge(InputStream input, File outputFile)

Description

copy Large

License

Apache License

Declaration

private static long copyLarge(InputStream input, File outputFile) throws IOException 

Method Source Code

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

import java.io.*;

public class Main {
    private static long copyLarge(InputStream input, File outputFile) throws IOException {
        byte[] buffer = new byte[16384];
        long count = 0;
        int n = 0;
        outputFile.getParentFile().mkdirs();
        FileOutputStream output = new FileOutputStream(outputFile);
        try {//from  w  ww . ja v a2 s.c o m
            while (-1 != (n = input.read(buffer))) {
                output.write(buffer, 0, n);
                count += n;
            }
        } finally {
            output.close();
        }
        return count;
    }
}

Related

  1. copyBytes(InputStream in, OutputStream out, int bufferSize, boolean close)
  2. copyBytes(InputStream in, OutputStream out, int buffSize)
  3. copyLarge(final InputStream input, final OutputStream output)
  4. copyLarge(final InputStream input, final OutputStream output)
  5. copyLarge(InputStream in, OutputStream out, byte[] buffer)
  6. copyLarge(InputStream input, OutputStream output)
  7. copyLarge(InputStream input, OutputStream output)
  8. copyLarge(InputStream input, OutputStream output)
  9. copyLarge(InputStream input, OutputStream output)