Packages

  • package root
    Definition Classes
    root
  • package grizzled

    The Grizzled Scala Library contains a variety of miscellaneous, general purpose utility classes and objects.

    The Grizzled Scala Library contains a variety of miscellaneous, general purpose utility classes and objects.

    The home page for the Grizzled Scala Library is http://software.clapper.org/grizzled-scala/. Please see that page for complete details, including installation instructions.

    Definition Classes
    root
  • package ScalaCompat

    Compatibility definitions for Scala 2.13+ vs.

    Compatibility definitions for Scala 2.13+ vs. Scala 2.12 and lesser. This object is conceptually similar to scala.collection.compat. For Scala 2.12 and earlier, it provides a type alias and compatibility functions for LazyList. For Scala 2.13 and greater, it's empty. Thus, all code can use LazyList throughout.

    Definition Classes
    grizzled
  • package collection

    Some collection-related helpers.

    Some collection-related helpers.

    Definition Classes
    grizzled
  • package config

    Classes and objects to aid in the parsing of INI-style configuration files.

    Classes and objects to aid in the parsing of INI-style configuration files. This package is similar, in concept, to the Python ConfigParser module (though its implementation and capabilities differ quite a bit).

    Definition Classes
    grizzled
  • package datetime
    Definition Classes
    grizzled
  • package file

    File-related classes and utilities.

    File-related classes and utilities. This package is distinguished from the grizzled.io package in that this package operates on files and paths, not on open streams or sources.

    Definition Classes
    grizzled
    See also

    grizzled.io

  • package io

    I/O-related classes and utilities.

    I/O-related classes and utilities. This package is distinguished from the grizzled.file package in that this package operates on already-open Java InputStream, OutputStream, Reader and Writer objects, and on Scala Source objects.

    See grizzled.file

    Definition Classes
    grizzled
  • package math

    Miscellaneous math and statistics utilities.

    Miscellaneous math and statistics utilities.

    Definition Classes
    grizzled
  • package net

    Network-related utility methods and classes.

    Network-related utility methods and classes.

    Definition Classes
    grizzled
  • package parsing

    Methods and classes useful for parsing various things.

    Methods and classes useful for parsing various things.

    Definition Classes
    grizzled
  • package random
    Definition Classes
    grizzled
  • package security
    Definition Classes
    grizzled
  • package string

    String- and text-related classes.

    String- and text-related classes.

    Definition Classes
    grizzled
  • package util

    Miscellaneous utility functions and methods not otherwise categorized.

    Miscellaneous utility functions and methods not otherwise categorized.

    Definition Classes
    grizzled
  • CanReleaseResource
  • Implicits
  • package zip

    The grizzled.zip package contains classes and functions to make it easier to operate on zip and jar files.

    The grizzled.zip package contains classes and functions to make it easier to operate on zip and jar files.

    Definition Classes
    grizzled

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

    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. def tryWithResource[T, R](open: ⇒ T)(code: (T) ⇒ R)(implicit mgr: CanReleaseResource[T]): Try[R]

    A version of grizzled.util.withResource that captures any thrown exception, instead of propagating it.

    A version of grizzled.util.withResource that captures any thrown exception, instead of propagating it.

    T

    the type of the resource

    R

    the return type of the code block

    open

    the by-name parameter (code block) to open the resource. This parameter is a by-name parameter so that this function can capture any exceptions it throws.

    code

    the code block to execute with the resource

    mgr

    the resource manager that can release the resource

    returns

    A Success containing the result of the code block, or a Failure with any thrown exception.

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

    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 => ...
    }

    Note: If the block throws an exception, withResource propagates the exception. If you want to capture the exception, instead, use grizzled.util.tryWithResource.

    T

    the type of the resource

    R

    the return type of the code block

    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

  3. object CanReleaseResource

    Companion object for CanReleaseResource.

  4. object Implicits

Inherited from AnyRef

Inherited from Any

Ungrouped