object Manager
- Companion:
- class
- Source:
- Using.scala
Value members
Concrete methods
Performs 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.
- Type parameters:
- A
the return type of the operation
- Value parameters:
- op
the operation to perform using the manager
- Returns:
a Try containing an exception if one or more were thrown, or the result of the operation if no exceptions were thrown
- Source:
- Using.scala