implicit final class ApsoCloseable[U <: AutoCloseable] extends AnyVal
Implicit class that provides new methods for closeable resources.
- Alphabetic
- By Inheritance
- ApsoCloseable
- AnyVal
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
ApsoCloseable(res: U)
- res
the closeable resource to which the new methods are provided.
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- Any
-
final
def
##(): Int
- Definition Classes
- Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
getClass(): Class[_ <: AnyVal]
- Definition Classes
- AnyVal → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- val res: U
-
def
toString(): String
- Definition Classes
- Any
-
def
tryUse[T](f: (U) ⇒ T): Try[T]
Uses this resource and closes it afterwards.
Uses this resource and closes it afterwards.
Any exception thrown by the code block or during the call to
close()of theAutoCloseableresource is caught and presented as aFailurein return value.- T
the return type of the code block.
- f
the block of code to execute using this resource
- returns
a
Tryof the value returned by the code block.
-
def
use[T](f: (U) ⇒ T): T
Uses this resource and closes it afterwards.
Uses this resource and closes it afterwards.
- T
the return type of the code block.
- f
the block of code to execute using this resource
- returns
the value returned by the code block.