(T object)
| 114 | |
| 115 | // same as free() but can be used when input object type is not guaranteed to be Closeable |
| 116 | public static <T> T freeIfCloseable(T object) { |
| 117 | if (object instanceof Closeable) { |
| 118 | try { |
| 119 | ((Closeable) object).close(); |
| 120 | } catch (IOException e) { |
| 121 | throw new FatalError(e); |
| 122 | } |
| 123 | } |
| 124 | return null; |
| 125 | } |
| 126 | |
| 127 | public static <T extends Closeable> void freeObjList(ObjList<T> list) { |
| 128 | if (list != null) { |