ZIOTable
The methods here are basically copies of the same methods in Table, but resulting in IO rather than Try.
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ZIOTable.type
Members list
Value members
Concrete methods
Method to construct one of the standard table types, given an Iterable of T and an optional header.
Method to construct one of the standard table types, given an Iterable of T and an optional header.
Type parameters
- X
-
the underlying type of xs.
Value parameters
- maybeHeader
-
an optional Header.
- xs
-
an Iterable of X.
Attributes
- Returns
-
a Table[X] which is either a HeadedTable or an UnheadedTable, as appropriate.
A ZPipeline which renders rows as the lines of a CSV file: the header first, then one line for each row (without line endings: see writeCSVFile).
A ZPipeline which renders rows as the lines of a CSV file: the header first, then one line for each row (without line endings: see writeCSVFile).
Type parameters
- X
-
the row type.
Value parameters
- generator
-
implicit CsvGenerator[X] (for the header).
- renderer
-
implicit CsvRenderer[X].
Attributes
- Returns
-
a ZPipeline[Any, Nothing, X, String].
Primary method to parse a table from an Iterator of String. This method is, in turn, invoked by all other parse methods defined below (other than parseSequence).
Primary method to parse a table from an Iterator of String. This method is, in turn, invoked by all other parse methods defined below (other than parseSequence).
Type parameters
- T
-
the type of the resulting table.
Value parameters
- ws
-
the Strings.
Attributes
- Returns
-
an IO[T]
Method to parse a table from an Iterator of String, reading as many header rows as the TableParser expects.
Method to parse a table from an Iterator of String, reading as many header rows as the TableParser expects.
Type parameters
- T
-
the type of the resulting table.
Value parameters
- ws
-
the Strings.
Attributes
- Returns
-
an Task[T]
Method to parse a table from an Iterable of String.
Method to parse a table from an Iterable of String.
Type parameters
- T
-
the type of the resulting table.
Value parameters
- ws
-
the Strings.
Attributes
- Returns
-
an IO[T]
Method to parse a table from a Source (with proper resource management of the source).
Method to parse a table from a Source (with proper resource management of the source).
Type parameters
- T
-
the type of the resulting table.
Value parameters
- si
-
the Source.
Attributes
- Returns
-
an IO[T]
Method to parse a table from a URI with an implicit encoding.
Method to parse a table from a URI with an implicit encoding.
Type parameters
- T
-
the type of the resulting table.
Value parameters
- codec
-
(implicit) the encoding.
- u
-
the URI.
Attributes
- Returns
-
an IO[T]
Method to parse a table from a URI with an explicit encoding.
Method to parse a table from a URI with an explicit encoding.
Type parameters
- T
-
the type of the resulting table.
Value parameters
- enc
-
the encoding.
- u
-
the URI.
Attributes
- Returns
-
an IO[T]
Method to parse a table from a File.
Method to parse a table from a File.
NOTE: you should use parseFile(String) if you have a pathname in String form.
TESTME
Type parameters
- T
-
the type of the resulting table.
Value parameters
- enc
-
the explicit encoding.
- f
-
the File (call by name in case there is an exception thrown while constructing the file).
Attributes
- Returns
-
an Task[T]
Method to parse a table from an File.
Method to parse a table from an File.
NOTE: you should use parseFile(String) if you have a pathname in String form.
TESTME
Type parameters
- T
-
the type of the resulting table.
Value parameters
- codec
-
(implicit) the encoding.
- f
-
the File (call by name in case there is an exception thrown while constructing the file).
Attributes
- Returns
-
an Task[T]
Method to parse a table from a File.
Method to parse a table from a File.
Type parameters
- T
-
the type of the resulting table.
Value parameters
- enc
-
the explicit encoding.
- pathname
-
the file pathname.
Attributes
- Returns
-
an Task[T]
Method to parse a table from an File.
Method to parse a table from an File.
Type parameters
- T
-
the type of the resulting table.
Value parameters
- codec
-
(implicit) the encoding.
- pathname
-
the file pathname.
Attributes
- Returns
-
a Task[T]
Method to parse a table from a File as a table of Seq[String].
Method to parse a table from a File as a table of Seq[String].
Value parameters
- codec
-
(implicit) the encoding.
- f
-
the file.
- forgiving
-
forcing (defaults to true). If true (the default) then an individual malformed row will not prevent subsequent rows being parsed.
- maybeFixedHeader
-
an optional fixed header. If None (the default), we expect to find the header defined in the first line of the file.
Attributes
- Returns
-
an Task of Table[RawRow] where RawRow is a Seq[String].
Method to parse a table from a File as a table of Seq[String].
Method to parse a table from a File as a table of Seq[String].
Value parameters
- codec
-
(implicit) the encoding.
- pathname
-
the path name.
Attributes
- Returns
-
an Task of Table[RawRow] where RawRow is a Seq[String].
Method to parse a table from an InputStream with an implicit encoding.
Method to parse a table from an InputStream with an implicit encoding.
Type parameters
- T
-
the type of the resulting table.
Value parameters
- codec
-
(implicit) the encoding.
- i
-
the InputStream (call-by-name).
Attributes
- Returns
-
an IO[T]
Method to parse a table from an InputStream with an explicit encoding.
Method to parse a table from an InputStream with an explicit encoding.
Type parameters
- T
-
the type of the resulting table.
Value parameters
- enc
-
the encoding.
- si
-
the InputStream, wrapped in Task.
Attributes
- Returns
-
an Task[T]
Method to parse a table of raw rows from an Iterable of String.
Method to parse a table of raw rows from an Iterable of String.
Value parameters
- ws
-
the Strings.
Attributes
- Returns
-
an Task of Table of RawRow
Method to parse a table from an File.
Method to parse a table from an File.
Type parameters
- T
-
the type of the resulting table.
Value parameters
- clazz
-
the class for which the resource should be sought (should default to the calling class but doesn't).
- codec
-
(implicit) the encoding.
- w
-
the resource name.
Attributes
- Returns
-
an Task[T]
Method to parse a table from a URL.
Method to parse a table from a URL.
Type parameters
- T
-
the type of the resulting table.
Value parameters
- u
-
the URI.
Attributes
- Returns
-
an Task[T]
Method to parse a table from a URL with an explicit encoding.
Method to parse a table from a URL with an explicit encoding.
NOTE: the logic here is different from that of parseResource(u:=>URL)(using codec: Codec) above.
Type parameters
- T
-
the type of the resulting table.
Value parameters
- enc
-
the encoding.
- u
-
the URL.
Attributes
- Returns
-
an Task[T]
Method to parse a table from a resource as a table of Seq[String].
Method to parse a table from a resource as a table of Seq[String].
Value parameters
- clazz
-
the class for which the resource should be sought (defaults to the calling class).
- codec
-
(implicit) the encoding.
- forgiving
-
forcing (defaults to true). If true (the default) then an individual malformed row will not prevent subsequent rows being parsed.
- maybeFixedHeader
-
an optional fixed header. If None (the default), we expect to find the header defined in the first line of the file.
- s
-
the resource name.
Attributes
- Returns
-
an Task of Table[RawRow] where RawRow is a Seq[String].
Method to parse a table from a sequence of sequences of String (one per row, already split into cells).
Method to parse a table from a sequence of sequences of String (one per row, already split into cells).
Type parameters
- T
-
the type of the resulting table.
Value parameters
- wss
-
the rows, each a sequence of Strings.
Attributes
- Returns
-
an Task[T]
Method to parse a table from a Source.
Method to parse a table from a Source.
NOTE: the caller is responsible for closing the given Source.
Type parameters
- T
-
the type of the resulting table.
Value parameters
- x
-
the Source.
Attributes
- Returns
-
an IO[T]
Method to stream the rows of a table, as they are read: the whole table is never in memory. The source is opened when the stream is run, and closed when it ends (whether it completes, fails or is interrupted). The header is read first (as parser reads it); then each row is parsed as it is pulled. The parser's predicate selects the rows; if the parser is forgiving, a row which can't be parsed is logged and left out, otherwise the stream fails with its exception.
Method to stream the rows of a table, as they are read: the whole table is never in memory. The source is opened when the stream is run, and closed when it ends (whether it completes, fails or is interrupted). The header is read first (as parser reads it); then each row is parsed as it is pulled. The parser's predicate selects the rows; if the parser is forgiving, a row which can't be parsed is logged and left out, otherwise the stream fails with its exception.
The parser is passed as a value (not a given) so that the type of its rows is known: for example, ZIOTable.stream(MovieTableParser)(source) is a ZStream[Any, Throwable, Movie].
Value parameters
- parser
-
a StringTableParser (e.g. a HeadedCSVTableParser, or a RawTableParser).
- source
-
the Source (call-by-name: it is made when the stream is run).
Attributes
- Returns
-
a ZStream[Any, Throwable, parser.Row].
Method to stream the rows of a file (see stream).
Method to stream the rows of a file (see stream).
Value parameters
- codec
-
(implicit) the encoding.
- parser
-
a StringTableParser.
- path
-
the path of the file.
Attributes
- Returns
-
a ZStream[Any, Throwable, parser.Row].
Method to stream the rows of some lines (see stream).
Method to stream the rows of some lines (see stream).
Value parameters
- parser
-
a StringTableParser.
- ws
-
the lines.
Attributes
- Returns
-
a ZStream[Any, Throwable, parser.Row].
Method to stream the rows of a resource (see stream).
Method to stream the rows of a resource (see stream).
Value parameters
- clazz
-
the class relative to which the resource is found.
- codec
-
(implicit) the encoding.
- parser
-
a StringTableParser.
- w
-
the name of the resource.
Attributes
- Returns
-
a ZStream[Any, Throwable, parser.Row].
Method to stream the rows of a URI (see stream). If the URI has a fragment identifier which selects rows (RFC 7111, e.g. "data.csv#row=5-7": see CsvFragment), only those rows are streamed, and the input is read no further than the last row which could be selected.
Method to stream the rows of a URI (see stream). If the URI has a fragment identifier which selects rows (RFC 7111, e.g. "data.csv#row=5-7": see CsvFragment), only those rows are streamed, and the input is read no further than the last row which could be selected.
Value parameters
- codec
-
(implicit) the encoding.
- parser
-
a StringTableParser.
- uri
-
the URI.
Attributes
- Returns
-
a ZStream[Any, Throwable, parser.Row].
Method to render this Table[T] as a CSV String with (maybe) header.
Method to render this Table[T] as a CSV String with (maybe) header.
Value parameters
- csvAttributes
-
implicit value of CsvAttributes.
- t
-
the table.
Attributes
- Returns
-
a String.
Method to render the given Table[Row] as a CSV String with header.
Method to render the given Table[Row] as a CSV String with header.
Value parameters
- csvAttributes
-
implicit value of CsvAttributes.
- t
-
the Table[Row] to be rendered.
Attributes
- Returns
-
an Iterable[String]
A ZSink which writes rows to a CSV file, as they come: the header first, then one line for each row, each line ending with the CsvAttributes newline. The file is closed when the stream ends.
A ZSink which writes rows to a CSV file, as they come: the header first, then one line for each row, each line ending with the CsvAttributes newline. The file is closed when the stream ends.
Type parameters
- X
-
the row type.
Value parameters
- csvAttributes
-
implicit CsvAttributes.
- generator
-
implicit CsvGenerator[X] (for the header).
- path
-
the path of the file.
- renderer
-
implicit CsvRenderer[X].
Attributes
- Returns
-
a ZSink which yields the number of bytes written.
Method to render this Table[T] as a CSV file with (maybe) header. NOTE: the FileWriter is flushed but not closed (see writeCSVFileRow, which closes it).
Method to render this Table[T] as a CSV file with (maybe) header. NOTE: the FileWriter is flushed but not closed (see writeCSVFileRow, which closes it).
Value parameters
- csvAttributes
-
implicit value of CsvAttributes.
- file
-
instance of File where the output should be stored.
- generator
-
implicit value of CsvProductGenerator[Row].
- renderer
-
implicit value of CsvRenderer[Row].
Attributes
Method to render the given Table[Row] as a CSV String with header.
Method to render the given Table[Row] as a CSV String with header.
Value parameters
- csvAttributes
-
implicit value of CsvAttributes.
- file
-
the destination File for the rendering of t.
- t
-
the Table[Row] to be rendered.
Attributes
- Returns
-
an Iterable[String]