scala.util.Using.Manager
See theManager companion class Members listPerforms an operation using a Manager
, then closes the Manager
, releasing its resources (in reverse order of acquisition).
Performs an operation using a Manager
, then closes the Manager
, 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 implicit Manager
as a parameter, this method should be invoked with an implicit
modifier before the function parameter:
Example:
val lines = Using.Manager { implicit use =>
new SafeFileReader("file.txt").lines()
}
See the main doc for Using
for full details of suppression behavior.
the return type of the operation
the operation to perform using the manager
a Try containing an exception if one or more were thrown, or the result of the operation if no exceptions were thrown
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4