Here you can find the source of copyStreams(InputStream inputStream, OutputStream outputStream)
Parameter | Description |
---|---|
inputStream | InputStream |
outputStream | OutputStream |
Parameter | Description |
---|---|
IOException | if I/O exception |
public static void copyStreams(InputStream inputStream, OutputStream outputStream) throws IOException
//package com.java2s; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; public class Main { /**//from w ww. j a v a 2 s . c o m * Copy the input stream to the output stream * * @param inputStream InputStream * @param outputStream OutputStream * @throws IOException if I/O exception */ public static void copyStreams(InputStream inputStream, OutputStream outputStream) throws IOException { byte[] buffer = new byte[1024]; int length; while ((length = inputStream.read(buffer)) >= 0) { outputStream.write(buffer, 0, length); } } }