package plus
- Alphabetic
- Public
- All
Type Members
-
trait
OnTryFinally
extends AnyRef
A mix-in trait which provides an
onTry { ... } onFinally { ... }andonTry { ... } onThrowable { ... }statement.A mix-in trait which provides an
onTry { ... } onFinally { ... }andonTry { ... } onThrowable { ... }statement. These statements chain exceptions from both code blocks viaThrowable.addSuppressed(Throwable). -
trait
ResourceLoan
extends AnyRef
A mix-in trait which provides Java's basic "try-with-resources" statement.
A mix-in trait which provides Java's basic "try-with-resources" statement.
Usage example:
import net.java.truecommons3.shed.ResourceLoan_ val out: OutputStream = ... loan(new PrintWriter(out)) to { w: PrintWriter => w.println("Hello world!") }
In this example,
w.close()is guaranteed to get called even if the to-function terminates with a Throwable.In general, if the to-function throws a throwable
t1and theAutoCloseable.close()method throws another throwablet2, then the throwablet2gets added to the throwablet1usingt1.addSuppressed(t2).
Value Members
-
object
OnTryFinally
extends OnTryFinally
An object which provides an
onTry { ... } onFinally { ... }andonTry { ... } onThrowable { ... }statement.An object which provides an
onTry { ... } onFinally { ... }andonTry { ... } onThrowable { ... }statement. These statements chain exceptions from both code blocks viaThrowable.addSuppressed(Throwable). -
object
ResourceLoan
extends ResourceLoan
An object which provides Java's basic "try-with-resources" statement.
An object which provides Java's basic "try-with-resources" statement.
Usage example:
import net.java.truecommons3.shed.ResourceLoan_ val out: OutputStream = ... loan(new PrintWriter(out)) to { w: PrintWriter => w.println("Hello world!") }
In this example,
w.close()is guaranteed to get called even if the to-function terminates with a Throwable.In general, if the to-function throws a throwable
t1and theAutoCloseable.close()method throws another throwablet2, then the throwablet2gets added to the throwablet1usingt1.addSuppressed(t2).