Java File Save saveInputToOutput(InputStream is, OutputStream os)

Here you can find the source of saveInputToOutput(InputStream is, OutputStream os)

Description

Save stream from input to output.

License

Open Source License

Parameter

Parameter Description
is a parameter
os a parameter

Exception

Parameter Description
IOException an exception

Return

true if there is no IO exception

Declaration

public static boolean saveInputToOutput(InputStream is, OutputStream os) throws IOException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public class Main {
    /**/* ww w  . ja  va2s . c om*/
     * Save stream from input to output.
     * 
     * @param is
     * @param os
     * @return true if there is no IO exception
     * @throws IOException
     */
    public static boolean saveInputToOutput(InputStream is, OutputStream os) throws IOException {
        byte[] buffer = new byte[1024];
        int i = -1;

        while ((i = is.read(buffer)) != -1) {
            os.write(buffer, 0, i);
        }
        os.flush();

        return true;
    }
}

Related

  1. saveConvert(String theString, boolean escapeSpace)
  2. saveDoubleMatrix(double[][] matrix, PrintStream out)
  3. saveFile(InputStream st, File testFile)
  4. saveFile(String fname, byte[] bytes)
  5. saveFile(String where)
  6. saveIntArray(int[] array, PrintStream out)
  7. SaveIntFile(int[] list, String filename)
  8. saveStreamAsString(InputStream is)
  9. saveStringDoubleMap(Map map, int dim, PrintStream out)