Java Stream Close close(final InputStream stream)

Here you can find the source of close(final InputStream stream)

Description

close

License

MIT License

Declaration

public static void close(final InputStream stream) 

Method Source Code

//package com.java2s;
/**/*from   w  ww . j  a  v  a 2 s. co  m*/
 * Copyright (c) 2009 Farata Systems  http://www.faratasystems.com
 *
 * Licensed under The MIT License
 * Re-distributions of files must retain the above copyright notice.
 *
 * @license http://www.opensource.org/licenses/mit-license.php The MIT License
 *
 */

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

import java.io.OutputStream;

public class Main {
    public static void close(final InputStream stream) {
        if (stream == null) {
            return;
        }
        try {
            stream.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static void close(final OutputStream stream) {
        if (stream == null) {
            return;
        }
        try {
            stream.close();
        } catch (final IOException e) {
            e.printStackTrace();
        }
    }
}

Related

  1. close(FileReader reader, BufferedReader br)
  2. close(final Closeable resource, final String resourceId)
  3. close(final Exception e, final Closeable... objects)
  4. close(final InputStream anInputStream)
  5. close(final InputStream is)
  6. close(final InputStream stream)
  7. close(final Logger logger, final Closeable... closeables)
  8. close(final Object stream)
  9. close(final OutputStream dest)