A
- the type of the result produced by the wrapped iterateepublic abstract class IO<A>
extends java.lang.Object
#enumFileLines(File, Option, IterV)
,
#enumFileChars(File, Option, IterV)
and #enumFileCharChunks(File, Option, IterV)
(the latter one is the fastest as char chunks read from the file are directly passed to the iteratee
without indirection in between).Modifier and Type | Field and Description |
---|---|
static F<java.io.Reader,IO<Unit>> |
closeReader |
Constructor and Description |
---|
IO() |
Modifier and Type | Method and Description |
---|---|
<B> IO<B> |
bind(F<A,IO<B>> f) |
static <A,B,C> IO<C> |
bracket(IO<A> init,
F<A,IO<B>> fin,
F<A,IO<C>> body) |
static IO<java.io.BufferedReader> |
bufferedReader(java.io.File f,
Option<java.nio.charset.Charset> encoding) |
static <A> F<java.io.Reader,F<Iteratee.IterV<char[],A>,IO<Iteratee.IterV<char[],A>>>> |
charChunkReader()
A function that feeds an iteratee with character chunks read from a
Reader
(char[] of size DEFAULT_BUFFER_SIZE ). |
static <A> F<java.io.Reader,F<Iteratee.IterV<java.lang.Character,A>,IO<Iteratee.IterV<java.lang.Character,A>>>> |
charChunkReader2()
A function that feeds an iteratee with characters read from a
Reader
(chars are read in chunks of size DEFAULT_BUFFER_SIZE ). |
static IO<Unit> |
closeReader(java.io.Reader r) |
static <A> IO<Iteratee.IterV<char[],A>> |
enumFileCharChunks(java.io.File f,
Option<java.nio.charset.Charset> encoding,
Iteratee.IterV<char[],A> i)
An IO monad that reads char chunks from the given file and passes them to the given iteratee.
|
static <A> IO<Iteratee.IterV<java.lang.Character,A>> |
enumFileChars(java.io.File f,
Option<java.nio.charset.Charset> encoding,
Iteratee.IterV<java.lang.Character,A> i)
An IO monad that reads char chunks from the given file and passes single chars to the given iteratee.
|
static <A> IO<Iteratee.IterV<java.lang.String,A>> |
enumFileLines(java.io.File f,
Option<java.nio.charset.Charset> encoding,
Iteratee.IterV<java.lang.String,A> i)
An IO monad that reads lines from the given file (using a
BufferedReader ) and passes
lines to the provided iteratee. |
static IO<java.io.Reader> |
fileReader(java.io.File f,
Option<java.nio.charset.Charset> encoding) |
static <A> F<java.io.BufferedReader,F<Iteratee.IterV<java.lang.String,A>,IO<Iteratee.IterV<java.lang.String,A>>>> |
lineReader()
A function that feeds an iteratee with lines read from a
BufferedReader . |
<B> IO<B> |
map(F<A,B> f) |
abstract A |
run() |
static <A> IO<A> |
unit(A a) |
public static <A> IO<Iteratee.IterV<java.lang.String,A>> enumFileLines(java.io.File f, Option<java.nio.charset.Charset> encoding, Iteratee.IterV<java.lang.String,A> i)
BufferedReader
) and passes
lines to the provided iteratee. May not be suitable for files with very long
lines, consider to use #enumFileCharChunks(File, IterV)
or #enumFileChars(File, IterV)
as an alternative.f
- the file to read, must not be null
encoding
- the encoding to use, Option.none()
means platform defaulti
- the iteratee that is fed with lines read from the filepublic static <A> IO<Iteratee.IterV<char[],A>> enumFileCharChunks(java.io.File f, Option<java.nio.charset.Charset> encoding, Iteratee.IterV<char[],A> i)
f
- the file to read, must not be null
encoding
- the encoding to use, Option.none()
means platform defaulti
- the iteratee that is fed with char chunks read from the filepublic static <A> IO<Iteratee.IterV<java.lang.Character,A>> enumFileChars(java.io.File f, Option<java.nio.charset.Charset> encoding, Iteratee.IterV<java.lang.Character,A> i)
f
- the file to read, must not be null
encoding
- the encoding to use, Option.none()
means platform defaulti
- the iteratee that is fed with chars read from the filepublic static IO<java.io.BufferedReader> bufferedReader(java.io.File f, Option<java.nio.charset.Charset> encoding)
public static IO<java.io.Reader> fileReader(java.io.File f, Option<java.nio.charset.Charset> encoding)
public static final <A> IO<A> unit(A a)
public static <A> F<java.io.BufferedReader,F<Iteratee.IterV<java.lang.String,A>,IO<Iteratee.IterV<java.lang.String,A>>>> lineReader()
BufferedReader
.public static <A> F<java.io.Reader,F<Iteratee.IterV<char[],A>,IO<Iteratee.IterV<char[],A>>>> charChunkReader()
Reader
(char[] of size DEFAULT_BUFFER_SIZE
).public static <A> F<java.io.Reader,F<Iteratee.IterV<java.lang.Character,A>,IO<Iteratee.IterV<java.lang.Character,A>>>> charChunkReader2()
Reader
(chars are read in chunks of size DEFAULT_BUFFER_SIZE
).public abstract A run() throws java.io.IOException
java.io.IOException