[OmniFaces utilities] The
close()
method check if the given resource is not null
and then close it, whereby any caught IOException
is been returned instead of thrown, so that the caller can if necessary handle (log) or just ignore it without the need to put another try-catch.Method:
Usage:
import org.omnifaces.util.Utils;
import
java.io.IOException;
...
IOException
close = Utils.close(closeable_resource);
The closeable_resource is the Closeable resource
to be closed. If you are using the Java 7 try-with-resources then closeable resources are automatically closed at the end of the statement. But, this method can be used to "force" the close operation before the end.
Niciun comentariu :
Trimiteți un comentariu