Here you can find the source of copyLarge(InputStream input, OutputStream output)
Parameter | Description |
---|---|
input | the input stream |
output | the output stream |
Parameter | Description |
---|---|
IOException | an exception |
public static long copyLarge(InputStream input, OutputStream output) throws IOException
//package com.java2s; //License from project: Apache License import java.io.*; public class Main { private static final int EOF = -1; private static final int DEFAULT_BUFFER_SIZE = 1024 * 4; /**//w w w .ja v a2 s .co m * copy the input stream to out. * @param input the input stream * @param output the output stream * @return the count of read. * @throws IOException */ public static long copyLarge(InputStream input, OutputStream output) throws IOException { byte[] buffer = new byte[DEFAULT_BUFFER_SIZE]; long count = 0; int n = 0; while (EOF != (n = input.read(buffer))) { output.write(buffer, 0, n); count += n; } return count; } }