Java Stream Close closeStreams(InputStream src, OutputStream dest)

Here you can find the source of closeStreams(InputStream src, OutputStream dest)

Description

Closes the streams and reports Exceptions to System.err

License

Apache License

Parameter

Parameter Description
src The InputStream to close.
dest The OutputStream to close.

Declaration

private static void closeStreams(InputStream src, OutputStream dest) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

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

import java.io.OutputStream;

public class Main {
    /**/*from w w  w.j av a 2  s . c o m*/
     * Closes the streams and reports Exceptions to System.err
     * @param src The InputStream to close.
     * @param dest The OutputStream to close.
     */
    private static void closeStreams(InputStream src, OutputStream dest) {
        try {
            src.close();
        } catch (IOException e) {
            e.printStackTrace();
        }

        try {
            dest.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

Related

  1. closeStream(OutputStream os)
  2. closeStreamIgnoreExpection(InputStream stream)
  3. closeStreamQuietly(final Closeable closeable)
  4. closeStreams(FileInputStream fis, FileOutputStream fos)
  5. closeStreams(InputStream iStream, OutputStream oStream)
  6. closeStreams(Process process)
  7. closeUnchecked(InputStream stream)
  8. closeWarnOnError(Closeable stream, Logger log, String message)
  9. closeWhileHandlingException(Closeable... objects)