All Downloads are FREE. Search and download functionalities are using the official Maven repository.

scalax.io.unmanaged.ReaderResource.scala Maven / Gradle / Ivy

package scalax.io
package unmanaged

import java.io.{Reader, BufferedReader}

/**
 * A ManagedResource for accessing and using Readers.  Class can be created using the [[scalax.io.Resource]] object.
 */
class ReaderResource[+A <: Reader] (
    resource: A,
    resourceContext:ResourceContext = DefaultResourceContext,
    closeAction: CloseAction[A] = CloseAction.Noop)
  extends ReadChars {

  self =>
  final val context = unmanagedContext(resourceContext)
  private[this] val open:OpenedResource[A] = new UnmanagedOpenedResource(resource, unmanagedContext(context))

  override def chars : LongTraversable[Char]= ResourceTraversable.readerBased(this.open, context)
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy