Here you can find the source of copyStreams(InputStream is, OutputStream os)
Parameter | Description |
---|---|
is | a parameter |
os | a parameter |
Parameter | Description |
---|---|
IOException | thrown if copy fails |
public static void copyStreams(InputStream is, OutputStream os) throws IOException
//package com.java2s; // %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; public class Main { /**//from w w w . j av a2 s . c o m * */ private static final int COPY_BUF_SIZE = 512; /** * copy is to os. * * @param is * @param os * @throws IOException thrown if copy fails */ public static void copyStreams(InputStream is, OutputStream os) throws IOException { byte[] bytearray = new byte[COPY_BUF_SIZE]; int len = 0; while ((len = is.read(bytearray)) != -1) { os.write(bytearray, 0, len); } } }