mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 11:02:00 -08:00
added quiet closing method in new streamutils class, used to clean up the connectdialog
This commit is contained in:
parent
0da4e10c49
commit
9912a23007
2 changed files with 28 additions and 11 deletions
21
Mage.Common/src/main/java/mage/utils/StreamUtils.java
Normal file
21
Mage.Common/src/main/java/mage/utils/StreamUtils.java
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
package mage.utils;
|
||||
|
||||
import java.io.Closeable;
|
||||
|
||||
public final class StreamUtils {
|
||||
|
||||
/***
|
||||
* Quietly closes the closable, ignoring nulls and exceptions
|
||||
* @param c - the closable to be closed
|
||||
*/
|
||||
public static void closeQuietly(Closeable c) {
|
||||
if (c != null) {
|
||||
try {
|
||||
c.close();
|
||||
}
|
||||
catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue