Performs an operation using aManager, then closes theManager, releasing its resources (in reverse order of acquisition).
Performs an operation using aManager, then closes theManager, releasing its resources (in reverse order of acquisition).
Example:
val lines = Using.Manager { use => use(new BufferedReader(new FileReader("file.txt"))).lines()}If using resources which require an implicitManager as a parameter, this method should be invoked with animplicit modifier before the function parameter:
Example:
val lines = Using.Manager { implicit use => new SafeFileReader("file.txt").lines()}See the main doc forUsing for full details of suppression behavior.
the return type of the operation
the operation to perform using the manager
aTry containing an exception if one or more were thrown, or the result of the operation if no exceptions were thrown