Here you can find the source of copyStream(InputStream in, OutputStream out)
Parameter | Description |
---|---|
in | input stream |
out | output stream |
Parameter | Description |
---|---|
IOException | thrown if reading or writing has failed |
public static void copyStream(InputStream in, OutputStream out) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.*; public class Main { /**//from ww w . j a v a 2 s . com * Copy the content of one stream to another. * * @param in input stream * @param out output stream * @throws IOException thrown if reading or writing has failed */ public static void copyStream(InputStream in, OutputStream out) throws IOException { byte[] bytes = new byte[1024]; int len; while ((len = in.read(bytes)) != -1) out.write(bytes, 0, len); } }