object io
Module of Process functions and combinators for file and network I/O.
- Source
- io.scala
- Alphabetic
- By Inheritance
- io
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
bufferedChannel[R, I, O](acquire: Task[R])(flush: (R) ⇒ Task[O])(release: (R) ⇒ Task[Unit])(step: (R) ⇒ Task[(I) ⇒ Task[O]]): Channel[Task, Option[I], O]
Implementation of resource for channels where resource needs to be flushed at the end of processing.
-
def
bufferedResource[F[_], R, O](acquire: F[R])(flushAndRelease: (R) ⇒ F[O])(step: (R) ⇒ F[O]): Process[F, O]
Like resource, but the
releaseaction may emit a final value, useful for flushing any internal buffers.Like resource, but the
releaseaction may emit a final value, useful for flushing any internal buffers. NB: In the event of an error, this final value is ignored. -
def
chunkR(is: ⇒ InputStream): Channel[Task, Int, ByteVector]
Creates a
Channel[Task,Int,ByteVector]from anInputStreamby repeatedly requesting the given number of bytes.Creates a
Channel[Task,Int,ByteVector]from anInputStreamby repeatedly requesting the given number of bytes. The last chunk may be less than the requested size.This implementation requires an array allocation for each read. To recycle the input buffer, use
unsafeChunkR.This implementation closes the
InputStreamwhen finished or in the event of an error. -
def
chunkW(os: ⇒ OutputStream): Sink[Task, ByteVector]
Creates a
Sinkfrom anOutputStream, which will be closed when thisProcessis halted. -
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
fileChunkR(f: String, bufferSize: Int = 4096): Channel[Task, Int, ByteVector]
Creates a
Channelfrom a file name and optional buffer size in bytes. -
def
fileChunkW(f: String, bufferSize: Int = 4096, append: Boolean = false): Sink[Task, ByteVector]
Creates a
Sinkfrom a file name and optional buffer size in bytes.Creates a
Sinkfrom a file name and optional buffer size in bytes.- append
if true, then bytes will be written to the end of the file rather than the beginning
-
def
fillBuffer[A](buf: Buffer[A]): Sink[Task, A]
A
Sinkwhich, as a side effect, adds elements to the givenBuffer. -
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
iterator[O](i: Task[Iterator[O]]): Process[Task, O]
Create a Process from an iterator.
Create a Process from an iterator. The value behind the iterator should be immutable and not rely on an external resource. If that is not the case, use
io.iteratorR. -
def
iteratorR[R, O](req: Task[R])(release: (R) ⇒ Task[Unit])(mkIterator: (R) ⇒ Task[Iterator[O]]): Process[Task, O]
Create a Process from an iterator that is tied to some resource,
R(like a file handle) that we want to ensure is released.Create a Process from an iterator that is tied to some resource,
R(like a file handle) that we want to ensure is released. SeelinesRfor an example use.- R
is the resource
- O
is a value in the iterator
- req
acquires the resource
- release
releases the resource
- mkIterator
creates the iterator from the resource
-
def
linesR(src: ⇒ scala.io.Source): Process[Task, String]
Creates a
Process[Task,String]from the lines of theSource, using theiteratorRcombinator to ensure theSourceis closed when processing the stream of lines is finished. -
def
linesR(in: ⇒ InputStream)(implicit codec: Codec): Process[Task, String]
Creates a
Process[Task,String]from the lines of theInputStream, using theiteratorRcombinator to ensure theInputStreamis closed when processing the stream of lines is finished. -
def
linesR(filename: String)(implicit codec: Codec): Process[Task, String]
Creates a
Process[Task,String]from the lines of a file, using theiteratorRcombinator to ensure the file is closed when processing the stream of lines is finished. -
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
def
print(out: PrintStream): Sink[Task, String]
Turn a
PrintStreaminto aSink.Turn a
PrintStreaminto aSink. ThisSinkdoes not emit newlines after each element. For that, useprintLines. -
def
printLines(out: PrintStream): Sink[Task, String]
Turn a
PrintStreaminto aSink.Turn a
PrintStreaminto aSink. ThisSinkemits newlines after each element. If this is not desired, useprint. -
def
printStreamSink[O](out: PrintStream)(f: (PrintStream, O) ⇒ Unit): Sink[Task, O]
Creates
Sinkfrom anPrintStreamusingfto perform specific side effects on thatPrintStream. -
def
resource[F[_], R, O](acquire: F[R])(release: (R) ⇒ F[Unit])(step: (R) ⇒ F[O]): Process[F, O]
Generic combinator for producing a
Process[F,O]from some effectfulOsource.Generic combinator for producing a
Process[F,O]from some effectfulOsource. The source is tied to some resource,R(like a file handle) that we want to ensure is released. SeechunkWfor an example use. -
def
stdInBytes: Channel[Task, Int, ByteVector]
The standard input stream, as
Process.The standard input stream, as
Process. ThisProcessrepeatedly awaits and emits chunks of bytes from standard input. -
def
stdInLines: Process[Task, String]
The standard input stream, as
Process.The standard input stream, as
Process. ThisProcessrepeatedly awaits and emits lines from standard input. -
def
stdOut: Sink[Task, String]
The standard output stream, as a
Sink.The standard output stream, as a
Sink. ThisSinkdoes not emit newlines after each element. For that, usestdOutLines. -
def
stdOutBytes: Sink[Task, ByteVector]
The standard output stream, as a
ByteVectorSink. -
def
stdOutLines: Sink[Task, String]
The standard output stream, as a
Sink.The standard output stream, as a
Sink. ThisSinkemits newlines after each element. If this is not desired, usestdOut. -
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toInputStream(p: Process[Task, ByteVector]): InputStream
Converts a source to a mutable
InputStream.Converts a source to a mutable
InputStream. The resulting input stream should be reasonably efficient and supports early termination (i.e. all finalizers associated with the input process will be run if the stream is closed). -
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
unsafeChunkR(is: ⇒ InputStream): Channel[Task, Array[Byte], Array[Byte]]
Creates a
Channel[Task,Array[Byte],Array[Byte]]from anInputStreamby repeatedly filling the input buffer.Creates a
Channel[Task,Array[Byte],Array[Byte]]from anInputStreamby repeatedly filling the input buffer.is.readwill be called multiple times as needed; however, the last chunk may be less than the requested size.It is safe to recycle the same buffer for consecutive reads as long as whatever consumes this
Processnever stores theArray[Byte]returned or pipes it to a combinator (likebuffer) that does. UsechunkRfor a safe version of this combinator - this takes anIntnumber of bytes to read and allocates a freshArray[Byte]for each read.This implementation closes the
InputStreamwhen finished or in the event of an error. -
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )