1 | void close(OutputStream device) {↵ | | 1 | void close(Writer device) {↵
|
2 | if (device != null) {↵ | | 2 | if (device != null) {↵
|
3 | try {↵ | | 3 | try {↵
|
4 | device.close();↵ | | 4 | device.close();↵
|
5 | } catch (IOException ioex) {↵ | | 5 | } catch (IOException ioex) {↵
|
6 | //ignore↵ | | 6 | //ignore↵
|
7 | }↵ | | 7 | }↵
|
8 | }↵ | | 8 | }↵
|
9 | }↵ | | 9 | }↵
|
|
10 | /**↵ | | 10 | /**↵
|
11 | * Close a stream without throwing any exception if something went wrong.↵ | | 11 | * Close a stream without throwing any exception if something went wrong.↵
|
12 | * Do not attempt to close it if the argument is null.↵ | | 12 | * Do not attempt to close it if the argument is null.↵
|
13 | *↵ | | 13 | *↵
|
14 | * @param device stream, can be null.↵ | | 14 | * @param device Reader, can be null.↵
|
15 | */↵ | | 15 | */↵
|
16 | public static void close(InputStream device) {↵ | | 16 | public static void close(Reader device) {↵
|
17 | if (device != null) {↵ | | 17 | if (device != null) {↵
|
18 | try {↵ | | 18 | try {↵
|
19 | device.close();↵ | | 19 | device.close();↵
|
20 | } catch (IOException ioex) {↵ | | 20 | } catch (IOException ioex) {↵
|
21 | //ignore↵ | | 21 | //ignore↵
|
22 | }↵ | | 22 | }↵
|
23 | }↵ | | 23 | }↵
|
24 | | | 24 |
|