Here you can find the source of copyStream(InputStream in, OutputStream out, int bufsize)
in
to out
Parameter | Description |
---|---|
in | the InputStream to copy from |
out | the OutputStream to copy to |
bufsize | buffer size |
public static void copyStream(InputStream in, OutputStream out, int bufsize) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; public class Main { /**/*from w ww . jav a 2 s .c om*/ * Copies everything from <code>in</code> to <code>out</code> * * @param in * the {@link InputStream} to copy from * @param out * the {@link OutputStream} to copy to * @param bufsize * buffer size */ public static void copyStream(InputStream in, OutputStream out, int bufsize) throws IOException { byte[] buffer = new byte[bufsize]; int len; while ((len = in.read(buffer)) != -1) out.write(buffer, 0, len); } }