Package

grizzled

util

Permalink

package util

Miscellaneous utility functions and methods not otherwise categorized.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. util
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. trait CanReleaseResource[-T] extends AnyRef

    Permalink

    withResource() needs an implicit evidence parameter of this type to know how to release what's passed to it.

    withResource() needs an implicit evidence parameter of this type to know how to release what's passed to it.

    T

    the type (which must be contravariant to allow, for instance, a T of Closeable to apply to subclasses like InputStream).

    Annotations
    @implicitNotFound( ... )

Value Members

  1. object CanReleaseResource

    Permalink

    Companion object for CanReleaseResource, providing predefined implicit evidence parameters for withResource().

  2. object Implicits

    Permalink
  3. def withResource[T, R](resource: T)(code: (T) ⇒ R)(implicit mgr: CanReleaseResource[T]): R

    Permalink

    Ensure that a closeable object is closed.

    Ensure that a closeable object is closed. Note that this function requires an implicit evidence parameter of type CanClose to determine how to close the object. You can implement your own, though common ones are provided automatically.

    Sample use:

    withResource(new java.io.FileInputStream("/path/to/file")) {
        in => ...
    }
    resource

    the object that holds a resource to be released

    code

    the code block to execute with the resource

    mgr

    the resource manager that can release the resource

    returns

    whatever the block returns

Inherited from AnyRef

Inherited from Any

Ungrouped