Here you can find the source of copyStream(InputStream input, OutputStream output)
Parameter | Description |
---|---|
input | The input stream. |
output | The output stream. |
Parameter | Description |
---|
public static void copyStream(InputStream input, OutputStream output) throws IOException
//package com.java2s; // BSD License (http://lemurproject.org/galago-license) import java.io.*; public class Main { /**/*from w w w.j av a2s. c om*/ * Copies data from the input stream to the output stream. * * @param input The input stream. * @param output The output stream. * @throws java.io.IOException */ public static void copyStream(InputStream input, OutputStream output) throws IOException { byte[] data = new byte[65536]; while (true) { int bytesRead = input.read(data); if (bytesRead < 0) { break; } output.write(data, 0, bytesRead); } } }