scalax.io

CloseAction

trait CloseAction[-A] extends AnyRef

A strategy object representing an action to take upon closing a scalax.io.Resource. CloseActions can be composed using the +: and :+ method and can be added to a scalax.io.Resource when it is created or added to an existing scalax.io.Resource object.

If an exception is raised by the CloseAction it will be cause by the apply method and will be returned to the Resource calling the exception. Normally the exception will be added to the collection of Throwables in the Resource so errors triggered by the CloseActions will be obtainable from the Resource.

Also related to exceptions is the fact that all CloseActions will be executed when they are combined. For example if CloseAction A and B are combined and A fails with an exception B will still be executed.

The easiest method for creating a close action is to simply call the scalax.io.CloseAction.apply factory method. It takes a function and contructs a CloseAction from it.

val loggingCloseAction = CloseAction[Any]{_ =>
println("InputStream "+r+" is closing")
}
A

The type of object this action

Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. CloseAction
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def closeImpl(resource: A): List[Throwable]

    The actual implementation of the action.

    The actual implementation of the action. Implementers of a CloseAction must implement this method.

    resource

    the resource that will be closed.

    Attributes
    protected

Concrete Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. def +:[B <: A](other: CloseAction[B]): CloseAction[B]

    Construct a new CloseAction consisting of other then this.

    Construct a new CloseAction consisting of other then this.

    other

    an action to prepend to this action

    returns

    an action consisting of first executing other then this

  5. def :+[B <: A](other: CloseAction[B]): CloseAction[B]

    Construct a new CloseAction consisting of this then other.

    Construct a new CloseAction consisting of this then other.

    other

    an action to append to this action

    returns

    an action consisting of first executing this then other

  6. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  7. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  8. def apply(resource: A): List[Throwable]

    Execute the action and return any Exceptions that may have been raised during the execution of this method.

    Execute the action and return any Exceptions that may have been raised during the execution of this method.

    resource

    the resource being closed

    returns

    the errors that occurred while executing the message.

  9. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  10. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  11. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  12. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  13. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  14. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  15. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  16. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  17. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  18. final def notify(): Unit

    Definition Classes
    AnyRef
  19. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  20. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  21. def toString(): String

    Definition Classes
    AnyRef → Any
  22. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  23. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  24. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()

Inherited from AnyRef

Inherited from Any

Ungrouped