scalax.io

WriterResource

class WriterResource [+A <: Writer] extends WriteCharsResource[A] with ResourceOps[A, WriterResource[A]]

A ManagedResource for accessing and using Writers. Class can be created using the Resource object.

Linear Supertypes
WriteCharsResource[A], WriteChars, Resource[A], ResourceOps[A, WriterResource[A]], ManagedResourceOperations[A], ManagedResource[A], AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. WriterResource
  2. WriteCharsResource
  3. WriteChars
  4. Resource
  5. ResourceOps
  6. ManagedResourceOperations
  7. ManagedResource
  8. AnyRef
  9. Any
Visibility
  1. Public
  2. All

Instance Constructors

  1. new WriterResource (opener: ⇒ A, closeAction: CloseAction[A])

Value Members

  1. def ! : A @scala.util.continuations.cpsParam[Unit,Unit]

    Definition Classes
    ManagedResourceOperations → ManagedResource
  2. def != (arg0: AnyRef): Boolean

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

    Attributes
    final
    Definition Classes
    Any
  4. def ## (): Int

    Attributes
    final
    Definition Classes
    AnyRef → Any
  5. def == (arg0: AnyRef): Boolean

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

    Attributes
    final
    Definition Classes
    Any
  7. def acquireAndGet [B] (f: (A) ⇒ B): B

    Definition Classes
    ManagedResourceOperations → ManagedResource
  8. def acquireFor [B] (f: (A) ⇒ B): Either[List[Throwable], B]

    Definition Classes
    Resource → ManagedResource
  9. def and [B] (that: ManagedResource[B]): ManagedResource[(A, B)]

    Definition Classes
    ManagedResourceOperations → ManagedResource
  10. def appendCloseAction [B >: A] (newAction: CloseAction[B]): WriterResource[A]

    Add a CloseAction to the end of the CloseAction queue (the last action executed).

    Add a CloseAction to the end of the CloseAction queue (the last action executed).

    newAction

    The new action to append

    returns

    a new instance with the added CloseAction

    Definition Classes
    WriterResourceResourceOps
  11. def appendCloseAction [B >: A] (newAction: (B) ⇒ Unit): WriterResource[A]

    Creates a CloseAction from the function and passes it to appendCloseAction(CloseAction)

    Creates a CloseAction from the function and passes it to appendCloseAction(CloseAction)

    newAction

    The new action to append

    returns

    a new instance with the added CloseAction

    Definition Classes
    ResourceOps
  12. def asInstanceOf [T0] : T0

    Attributes
    final
    Definition Classes
    Any
  13. def clone (): AnyRef

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

    Attributes
    final
    Definition Classes
    AnyRef
  15. def equals (arg0: Any): Boolean

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

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  17. def flatMap [B] (f: (A) ⇒ ManagedResource[B]): ManagedResource[B]

    Definition Classes
    ManagedResourceOperations → ManagedResource
  18. def foreach (f: (A) ⇒ Unit): Unit

    Definition Classes
    ManagedResourceOperations → ManagedResource
  19. def getClass (): java.lang.Class[_]

    Attributes
    final
    Definition Classes
    AnyRef → Any
  20. def hashCode (): Int

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

    Attributes
    final
    Definition Classes
    Any
  22. def map [B] (f: (A) ⇒ B): ExtractableManagedResource[B]

    Definition Classes
    ManagedResourceOperations → ManagedResource
  23. def ne (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  24. def notify (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  25. def notifyAll (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  26. def open (): OpenedResource[A]

    Creates a new instance of the underlying resource (or opens it).

    Creates a new instance of the underlying resource (or opens it). Sometimes the code block used to create the Resource is non-reusable in which case this Resource can only be used once. This is not recommended. When creating a resource it is recommended to pass the code block for creating the resource to the resource so that the resource can be reused. Of course this is not always possible

    This method should only be used with care in cases when Automatic Resource Management cannot be used because the InputStream must be closed manually.

    This is public only to permit interoperability with certain Java APIs. A better pattern of use should be:

    resource.acquireFor {
      // call java API
    }
    

    or

    val calculatedResult = resource.acquireAndGet {
      // cal java API that returns a result
    }
    
    returns

    the actual resource that has been opened

    Definition Classes
    WriterResourceResource
  27. def open [U] (f: (WriteChars) ⇒ U): U

    Execute the function 'f' passing an WriteChars instance that performs all operations on a single opened connection to the underlying resource.

    Execute the function 'f' passing an WriteChars instance that performs all operations on a single opened connection to the underlying resource. Typically each call to one of the Output's methods results in a new connection. For example if the underlying OutputStream truncates the file each time the connection is made then calling write two times will result in the contents of the second write overwriting the second write.

    Even if the underlying resource is an appending, using open will be more efficient since the connection only needs to be made a single time.

    f

    the function to execute on the new Output instance (which uses a single connection)

    returns

    the result of the function

    Definition Classes
    WriteChars
  28. def prependCloseAction [B >: A] (newAction: CloseAction[B]): WriterResource[A]

    Add a CloseAction to the front of the CloseAction queue.

    Add a CloseAction to the front of the CloseAction queue.

    newAction

    The new action to prepend

    returns

    a new instance with the added CloseAction

    Definition Classes
    WriterResourceResourceOps
  29. def prependCloseAction [B >: A] (newAction: (B) ⇒ Unit): WriterResource[A]

    Creates a CloseAction from the function and passes it to prependCloseAction(CloseAction)

    Creates a CloseAction from the function and passes it to prependCloseAction(CloseAction)

    newAction

    The new action to prepend

    returns

    a new instance with the added CloseAction

    Definition Classes
    ResourceOps
  30. def reflect [B] : A @util.continuations.package.cps[Either[List[Throwable],B]]

    Definition Classes
    ManagedResourceOperations → ManagedResource
  31. def synchronized [T0] (arg0: ⇒ T0): T0

    Attributes
    final
    Definition Classes
    AnyRef
  32. def toString (): String

    Definition Classes
    AnyRef → Any
  33. def toTraversable [B] (implicit ev: <:<[A, TraversableOnce[B]]): Traversable[B]

    Definition Classes
    ManagedResourceOperations → ManagedResource
  34. def wait (): Unit

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

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

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  37. def write (characters: TraversableOnce[Char]): Unit

    Write several characters to the underlying object

    Write several characters to the underlying object

    Definition Classes
    WriteChars
  38. def writeStrings (strings: Traversable[String], separator: String = ""): Unit

    Write several strings.

    Write several strings. The open options that can be used are dependent on the implementation and implementors should clearly document which option are permitted.

    strings

    The data to write

    separator

    A string to add between each string. It is not added to the before the first string or after the last.

    Definition Classes
    WriteChars
  39. def writer : WriterResource[A]

    Attributes
    protected
    Definition Classes
    WriterResourceWriteChars

Inherited from WriteCharsResource[A]

Inherited from WriteChars

Inherited from Resource[A]

Inherited from ResourceOps[A, WriterResource[A]]

Inherited from ManagedResourceOperations[A]

Inherited from ManagedResource[A]

Inherited from AnyRef

Inherited from Any