Here you can find the source of copyStream(final InputStream src, OutputStream dest)
Parameter | Description |
---|---|
IOException | an exception |
public static void copyStream(final InputStream src, OutputStream dest) throws IOException
//package com.java2s; import java.io.*; public class Main { /**//from w w w. ja v a 2 s. c o m * Writes the content of an input stream to an output stream * * @throws IOException */ public static void copyStream(final InputStream src, OutputStream dest) throws IOException { byte[] buffer = new byte[1024]; int read = 0; while ((read = src.read(buffer)) > -1) { dest.write(buffer, 0, read); } dest.flush(); } }