Here you can find the source of close(OutputStream s)
Parameter | Description |
---|---|
s | the stream to call .close() on |
public static OutputStream close(OutputStream s)
//package com.java2s; /*/*w w w. j a v a2s.c o m*/ * ? Copyright IBM Corp. 2012-2013 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * implied. See the License for the specific language governing * permissions and limitations under the License. */ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.Reader; import java.io.Writer; public class Main { /** * Call close on an output stream and ignore any exception. * @param s the stream to call .close() on * @return OuputStream null * @ibm-api */ public static OutputStream close(OutputStream s) { if (s != null) { try { s.close(); } catch (IOException ioe) { /** ignore */ } } return null; } /** * Call close on an input stream and ignore any exception. * @param s the stream to call .close() on * @return InputStream null * @ibm-api */ public static InputStream close(InputStream s) { if (s != null) { try { s.close(); } catch (IOException ioe) { /** ignore */ } } return null; } /** * Call close on a Writer and ignore any exception. * @param s the Writer to call .close() on * @return Writer null * @ibm-api */ public static Writer close(Writer w) { if (w != null) { try { w.close(); } catch (IOException ioe) { /** ignore */ } } return null; } /** * Call close on a Reader and ignore any exception. * @param s the Reader to call .close() on * @return Reader null * @ibm-api */ public static Reader close(Reader r) { if (r != null) { try { r.close(); } catch (IOException ioe) { /** ignore */ } } return null; } }