Here you can find the source of inputStreamToOutputStream(final InputStream inputStream, final OutputStream outputStream)
public static void inputStreamToOutputStream(final InputStream inputStream, final OutputStream outputStream)
//package com.java2s; import java.io.InputStream; import java.io.OutputStream; public class Main { public static void inputStreamToOutputStream(final InputStream inputStream, final OutputStream outputStream) { try {// w w w .ja va 2 s . co m final byte[] buf = new byte[1024]; int length; while ((length = inputStream.read(buf)) > 0) { outputStream.write(buf, 0, length); } } catch (final Exception e) { throw new RuntimeException(e); } } }