Added closeQuietly methods
This commit is contained in:
parent
f98fce7012
commit
8213b41bc3
|
@ -175,6 +175,20 @@ class Sys {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convenient close for a stream.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("Duplicates")
|
||||||
|
public static
|
||||||
|
void closeQuietly(InputStream inputStream) {
|
||||||
|
if (inputStream != null) {
|
||||||
|
try {
|
||||||
|
inputStream.close();
|
||||||
|
} catch (IOException ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenient close for a stream.
|
* Convenient close for a stream.
|
||||||
*/
|
*/
|
||||||
|
@ -191,6 +205,20 @@ class Sys {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convenient close for a stream.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("Duplicates")
|
||||||
|
public static
|
||||||
|
void closeQuietly(OutputStream outputStream) {
|
||||||
|
if (outputStream != null) {
|
||||||
|
try {
|
||||||
|
outputStream.close();
|
||||||
|
} catch (IOException ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenient close for a Reader.
|
* Convenient close for a Reader.
|
||||||
*/
|
*/
|
||||||
|
@ -207,6 +235,20 @@ class Sys {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convenient close for a Reader.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("Duplicates")
|
||||||
|
public static
|
||||||
|
void closeQuietly(Reader inputReader) {
|
||||||
|
if (inputReader != null) {
|
||||||
|
try {
|
||||||
|
inputReader.close();
|
||||||
|
} catch (IOException ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenient close for a Writer.
|
* Convenient close for a Writer.
|
||||||
*/
|
*/
|
||||||
|
@ -223,6 +265,20 @@ class Sys {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convenient close for a Writer.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("Duplicates")
|
||||||
|
public static
|
||||||
|
void closeQuietly(Writer outputWriter) {
|
||||||
|
if (outputWriter != null) {
|
||||||
|
try {
|
||||||
|
outputWriter.close();
|
||||||
|
} catch (IOException ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy the contents of the input stream to the output stream.
|
* Copy the contents of the input stream to the output stream.
|
||||||
* <p/>
|
* <p/>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user