Here you can find the source of closeSilently(java.util.logging.Logger log, Closeable stream)
Parameter | Description |
---|---|
log | a parameter |
stream | a parameter |
public final static void closeSilently(java.util.logging.Logger log, Closeable stream)
//package com.java2s; /*/*from ww w. ja va 2 s. c o m*/ * @(#)SequenceUtil.java 1.0 September 2009 Copyright (c) 2009 Peter Troshin * Jalview Web Services version: 2.0 This library is free software; you can * redistribute it and/or modify it under the terms of the Apache License * version 2 as published by the Apache Software Foundation This library is * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the Apache License for more details. A copy of the * license is in apache_license.txt. It is also available here: see: * http://www.apache.org/licenses/LICENSE-2.0.txt Any republication or derived * work distributed in source code form must include this copyright and license * notice. */ import java.io.Closeable; import java.io.IOException; import java.util.logging.Level; public class Main { /** * Closes the Closable and logs the exception if any * * @param log * @param stream */ public final static void closeSilently(java.util.logging.Logger log, Closeable stream) { if (stream != null) { try { stream.close(); } catch (IOException e) { log.log(Level.WARNING, e.getLocalizedMessage(), e.getCause()); } } } }