Java Stream Close close(OutputStream os)

Here you can find the source of close(OutputStream os)

Description

Close output streams that are not print streams.

License

Open Source License

Parameter

Parameter Description
os The output stream to close.

Exception

Parameter Description
IOException When an I/O exception occurs.

Declaration

public static void close(OutputStream os) throws IOException 

Method Source Code

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

import java.io.IOException;

import java.io.OutputStream;

import java.io.PrintStream;

public class Main {
    /**//w w  w  .j  a  va  2s. c o  m
     * Close output streams that are not print streams.
     *
     * @param os
     *            The output stream to close.
     *
     * @throws IOException
     *             When an I/O exception occurs.
     *
     * @see PrintStream
     */
    public static void close(OutputStream os) throws IOException {
        if (!(os instanceof PrintStream)) {
            os.close();
        }
    }
}

Related

  1. close(JMXConnector connector)
  2. close(Object obj)
  3. close(Object resource)
  4. close(ObjectInput in)
  5. close(OutputStream in)
  6. close(OutputStream s)
  7. close(PrintStream writer)
  8. close(Process process)
  9. close(RandomAccessFile randomAccessFile)