Java InputStream to OutputStream copyStream(InputStream in, OutputStream out)

Here you can find the source of copyStream(InputStream in, OutputStream out)

Description

copy Stream

License

Open Source License

Declaration

private static final void copyStream(InputStream in, OutputStream out) throws IOException 

Method Source Code


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

import java.io.*;

public class Main {
    private static final void copyStream(InputStream in, OutputStream out) throws IOException {
        BufferedReader reader = null;
        PrintWriter outPrint = null;
        try {//from   ww  w .  j  a v a 2  s  .co m
            reader = new BufferedReader(new InputStreamReader(in));
            outPrint = new PrintWriter(out);
            String line;
            while ((line = reader.readLine()) != null) {
                outPrint.println(line);
            }
        } finally {
            if (reader != null) {
                reader.close();
            }
            if (outPrint != null) {
                outPrint.close();
            }
        }
    }
}

Related

  1. copyStream(InputStream in, OutputStream out)
  2. copyStream(InputStream in, OutputStream out)
  3. copyStream(InputStream in, OutputStream out)
  4. copyStream(InputStream in, OutputStream out)
  5. copyStream(InputStream in, OutputStream out)
  6. copyStream(InputStream in, OutputStream out)
  7. copyStream(InputStream in, OutputStream out)
  8. copyStream(InputStream in, OutputStream out)
  9. copyStream(InputStream in, OutputStream out)