Java InputStream Close close(InputStream inputStream)

Here you can find the source of close(InputStream inputStream)

Description

close

License

Open Source License

Declaration

public static void close(InputStream inputStream) throws IOException 

Method Source Code

//package com.java2s;
/******************************************************************************* 
 * Copyright (c) 2011 Red Hat, Inc. /*ww w . j a  v  a  2s.co m*/
 * Distributed under license by Red Hat, Inc. All rights reserved. 
 * This program is made available under the terms of the 
 * Eclipse Public License v1.0 which accompanies this distribution, 
 * and is available at http://www.eclipse.org/legal/epl-v10.html 
 * 
 * Contributors: 
 * Red Hat, Inc. - initial API and implementation 
 ******************************************************************************/

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

import java.io.OutputStream;
import java.io.Reader;

import java.io.Writer;

public class Main {
    public static void close(InputStream inputStream) throws IOException {
        if (inputStream != null) {
            inputStream.close();
        }
    }

    public static void close(OutputStream outputStream) throws IOException {
        if (outputStream != null) {
            outputStream.close();
        }
    }

    public static void close(Reader reader) throws IOException {
        if (reader != null) {
            reader.close();
        }
    }

    public static void close(Writer writer) throws IOException {
        if (writer != null) {
            writer.close();
        }
    }
}

Related

  1. close(InputStream in, boolean silent)
  2. close(InputStream in, OutputStream out)
  3. close(InputStream input)
  4. close(InputStream inputStream)
  5. close(InputStream inputstream)
  6. close(InputStream is)
  7. close(InputStream is)
  8. close(InputStream is)
  9. close(InputStream is)