Java InputStream to OutputStream inputStreamToOutputStream(InputStream inStream, OutputStream outStream)

Here you can find the source of inputStreamToOutputStream(InputStream inStream, OutputStream outStream)

Description

input Stream To Output Stream

License

Open Source License

Declaration

public static void inputStreamToOutputStream(InputStream inStream, OutputStream outStream) throws IOException 

Method Source Code


//package com.java2s;
import java.io.BufferedReader;

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;

public class Main {
    public static void inputStreamToOutputStream(InputStream inStream, OutputStream outStream) throws IOException {
        PrintWriter printWritter = new PrintWriter(new OutputStreamWriter(outStream));
        BufferedReader bufReader = new BufferedReader(new InputStreamReader(inStream));
        String line;//from w ww  .j ava 2  s . c  o m
        while ((line = bufReader.readLine()) != null) {
            printWritter.println(line);

        }
        printWritter.flush();
        //outStream.flush();

    }
}

Related

  1. copyStreamToStream(final InputStream input, final OutputStream output)
  2. copyStreamToStream(InputStream in, OutputStream out)
  3. inputStreamToOutputStream(final InputStream in, final OutputStream out)
  4. inputStreamToOutputStream(final InputStream in, final OutputStream out, int buffer)
  5. inputStreamToOutputStream(final InputStream inputStream, final OutputStream outputStream)
  6. inputStreamToOutputStream(InputStream is, OutputStream os)