Java Stream Close closeStream(Object oin)

Here you can find the source of closeStream(Object oin)

Description

close Stream

License

Apache License

Declaration

public static void closeStream(Object oin) 

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 {
    public static void closeStream(Object oin) {
        if (oin != null)
            try {
                if (oin instanceof InputStream)
                    ((InputStream) oin).close();
                if (oin instanceof OutputStream)
                    ((OutputStream) oin).close();
            } catch (IOException e) {
                e.printStackTrace();/* w  w  w. j  a  v  a  2 s  .  co  m*/
            }
    }
}

Related

  1. closeStream(final Object stream)
  2. closeStream(InputStream in)
  3. closeStream(InputStream in)
  4. closeStream(InputStream inputStream)
  5. closeStream(InputStream ins)
  6. closeStream(OutputStream os)
  7. closeStreamIgnoreExpection(InputStream stream)
  8. closeStreamQuietly(final Closeable closeable)
  9. closeStreams(FileInputStream fis, FileOutputStream fos)