Java tutorial
//package com.java2s; //License from project: Apache License import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; public class Main { public static void inputToOutput(FileOutputStream outputStream, InputStream inputStream) throws IOException { byte[] buffer = new byte[1024]; int len; while ((len = inputStream.read(buffer)) != -1) { outputStream.write(buffer, 0, len); } outputStream.close(); inputStream.close(); } }