Here you can find the source of dumpStreamToStream(InputStream is, OutputStream os)
Parameter | Description |
---|---|
is | a parameter |
os | a parameter |
public static void dumpStreamToStream(InputStream is, OutputStream os)
//package com.java2s; //License from project: Academic Free License import java.io.InputStream; import java.io.OutputStream; public class Main { /**/*from w ww . ja v a 2s .c o m*/ * Dump the input stream to the output stream. * * @param is * @param os */ public static void dumpStreamToStream(InputStream is, OutputStream os) { byte ba[] = new byte[2048]; int numRead = 0; try { numRead = is.read(ba); while (numRead > 0) { os.write(ba, 0, numRead); numRead = is.read(ba); } } catch (Exception ex) { ex.printStackTrace(); } finally { if (os != null) try { os.flush(); } catch (Exception ex) { } ; } } }