scalax.io

InputResource

trait InputResource [+R <: Closeable] extends Resource[R] with Input with ResourceOps[R, InputResource[R]]

An Resource object that is a also an Input. This trait adds methods for converting between common io types such as to a ReaderResource or ReadableByteChannelResource

R

the type of underlying resource that is created

Since

1.0

Linear Supertypes
Input, Resource[R], ResourceOps[R, InputResource[R]], ManagedResourceOperations[R], ManagedResource[R], AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. InputResource
  2. Input
  3. Resource
  4. ResourceOps
  5. ManagedResourceOperations
  6. ManagedResource
  7. AnyRef
  8. Any
Visibility
  1. Public
  2. All

Abstract Value Members

  1. def appendCloseAction [B >: R] (newAction: CloseAction[B]): InputResource[R]

    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

    Attributes
    abstract
    Definition Classes
    ResourceOps
  2. def blocks (blockSize: Option[Int] = None): LongTraversable[ByteBlock]

    Read the input as blocks of bytes.

    Read the input as blocks of bytes. This method should be avoided unless the maximum performance is absolutely required because bytes provides very good performance and is a better API for most applications.

    However since it better reflects how data is read with most input sources (like InputStreams and ReadableByteChannels); blocks is slightly more performance than bytes and therefore can be used when performance is the most important consideration.

    blockSize

    block size can optionally be specified but the default is normally acceptable.

    Attributes
    abstract
    Definition Classes
    Input
  3. def bytes : LongTraversable[Byte]

    Obtains a Traversable for conveniently processing the resource as bytes.

    Obtains a Traversable for conveniently processing the resource as bytes.

    returns

    an non-strict traversable over all the bytes

    Attributes
    abstract
    Definition Classes
    Input
  4. def chars (implicit codec: Codec = Codec.default): LongTraversable[Char]

    The characters in the object.

    The characters in the object.

    If the codec is not the same as the source codec (the codec of the underlying data) then the characters will converted to the desired codec.

    codec

    The codec representing the desired encoding of the characters @return an traversable of all the characters

    Attributes
    abstract
    Definition Classes
    Input
  5. def inputStream : InputResource[InputStream]

    Obtain the InputStreamResource(typically) version of this object.

    Obtain the InputStreamResource(typically) version of this object.

    returns

    the InputStreamResource(typically) version of this object.

    Attributes
    abstract
  6. def open (): OpenedResource[R]

    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

    Attributes
    abstract
    Definition Classes
    Resource
  7. def prependCloseAction [B >: R] (newAction: CloseAction[B]): InputResource[R]

    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

    Attributes
    abstract
    Definition Classes
    ResourceOps
  8. def readableByteChannel : InputResource[ReadableByteChannel]

    Obtain the ReadableByteChannelResource(typically) version of this object.

    Obtain the ReadableByteChannelResource(typically) version of this object.

    returns

    the ReadableByteChannelResource(typically) version of this object.

    Attributes
    abstract
  9. def reader (implicit sourceCodec: Codec = Codec.default): ReadCharsResource[Reader]

    Obtain the ReadCharsResource version of this object.

    Obtain the ReadCharsResource version of this object.

    returns

    the ReadCharsResource version of this object.

    Attributes
    abstract
  10. def sizeFunc : () ⇒ Option[Long]

    Attributes
    protected abstract

Concrete Value Members

  1. def ! : R @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: (R) ⇒ B): B

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

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

    Definition Classes
    ManagedResourceOperations → ManagedResource
  10. def appendCloseAction [B >: R] (newAction: (B) ⇒ Unit): InputResource[R]

    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
  11. def asInstanceOf [T0] : T0

    Attributes
    final
    Definition Classes
    Any
  12. def byteArray : Array[Byte]

    This method aspires to be the fastest way to read a stream of known length into memory.

    This method aspires to be the fastest way to read a stream of known length into memory.

    Definition Classes
    Input
  13. def bytesAsInts : LongTraversable[Int]

    Obtains a Traversable for conveniently processing the file as Ints.

    Obtains a Traversable for conveniently processing the file as Ints.

    returns

    an non-strict traversable over all the bytes with the bytes being represented as Ints

    Definition Classes
    Input
  14. def clone (): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  15. def copyDataTo (output: Output): Unit

    Copy all data from this Input object to the Output object as efficiently as possible.

    Copy all data from this Input object to the Output object as efficiently as possible.

    output

    output sink to copy the data to

    Definition Classes
    InputResourceInput
  16. def eq (arg0: AnyRef): Boolean

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

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

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

    Definition Classes
    ManagedResourceOperations → ManagedResource
  20. def foreach (f: (R) ⇒ Unit): Unit

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

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

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

    Attributes
    final
    Definition Classes
    Any
  24. def lines (terminator: Terminator = Terminators.Auto, includeTerminator: Boolean = false)(implicit codec: Codec = Codec.default): LongTraversable[String]

    Obtain an non-strict traversable for iterating through the lines in the object

    Obtain an non-strict traversable for iterating through the lines in the object

    If the codec is not the same as the source codec (the codec of the underlying data) then the characters will converted to the desired codec.

    terminator

    The strategy for determining the end of line Default is to auto-detect the EOL

    includeTerminator

    if true then the line will end with the line terminator Default is false

    @return a non-strict traversable for iterating through all the lines

    codec

    The codec representing the desired encoding of the characters

    Definition Classes
    Input
  25. def map [B] (f: (R) ⇒ B): ExtractableManagedResource[B]

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

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

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

    Attributes
    final
    Definition Classes
    AnyRef
  29. def prependCloseAction [B >: R] (newAction: (B) ⇒ Unit): InputResource[R]

    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] : R @util.continuations.package.cps[Either[List[Throwable],B]]

    Definition Classes
    ManagedResourceOperations → ManagedResource
  31. def size : Option[Long]

    The number of bytes that can be read from the underlying resource.

    The number of bytes that can be read from the underlying resource.

    if length == None then it is not possible to determine the number of bytes in advance.

    Attributes
    final
    Definition Classes
    InputResourceInput
  32. def slurpString (implicit codec: Codec = Codec.default): String

    Loads all the characters into memory.

    Loads all the characters into memory. There is no protection against loading very large files/amounts of data.

    codec

    The codec representing the desired encoding of the characters

    Definition Classes
    Input
  33. def synchronized [T0] (arg0: ⇒ T0): T0

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

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

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

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

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

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()

Inherited from Input

Inherited from Resource[R]

Inherited from ResourceOps[R, InputResource[R]]

Inherited from ManagedResourceOperations[R]

Inherited from ManagedResource[R]

Inherited from AnyRef

Inherited from Any