tinyscalautils.io
Members list
Type members
Classlikes
Text inputs, suitable to the read
and readAll
functions.
Text inputs, suitable to the read
and readAll
functions.
Attributes
- Companion
- object
- Source
- Input.scala
- Supertypes
Attributes
- Companion
- trait
- Source
- Input.scala
- Supertypes
- Self type
-
Input.type
Text outputs, suitable to the write
and writeAll
functions.
Text outputs, suitable to the write
and writeAll
functions.
Attributes
- Companion
- object
- Source
- Output.scala
- Supertypes
Attributes
- Companion
- trait
- Source
- Output.scala
- Supertypes
- Self type
-
Output.type
Value members
Concrete methods
The list of files and subdirectories in a directory, in no particular order.
The list of files and subdirectories in a directory, in no particular order.
Value parameters
- silent
-
if true, errors are ignored, and an empty list is returned.
Attributes
- Throws
-
IllegalArgumentException
if the path is not a directory.
- Since
-
1.0
- Source
- files.scala
Reads a text file as a single string. Encoding is UTF8.
Reads a text file as a single string. Encoding is UTF8.
Value parameters
- in
-
the source to read.
- silent
-
if true, errors are ignored, and an empty string is returned.
Attributes
- Since
-
1.3
- Note
-
If the input is closable, this function closes it.
- Source
- Input.scala
Parses a text source (sequence of lines) using a given parser to split each line. Lines that parse to an empty sequence (such as None
) are ignored. Encoding is UTF8.
Parses a text source (sequence of lines) using a given parser to split each line. Lines that parse to an empty sequence (such as None
) are ignored. Encoding is UTF8.
Value parameters
- factory
-
a factory for the desired collection type.
- in
-
the source to parse.
- parser
-
the parser to use; if omitted, each line is taken as a whole except blank lines, which are ignored.
- silent
-
if true, errors are ignored, and an empty collection is returned.
Attributes
- Returns
-
a factory-based collection of all the parts of all the lines.
- Since
-
1.3
- Note
-
If the input is closable, this function closes it.
- Source
- Input.scala
Simplified form of readAll
that uses List
as the factory.
Simplified form of readAll
that uses List
as the factory and false
for the silent
argument.
Simplified form of readAll
that uses List
as the factory and false
for the silent
argument.
Attributes
- Since
-
1.3
- Source
- Input.scala
Simplified form of readAll
that does not parse (blank lines are ignored) and uses List
as the factory.
Simplified form of readAll
that does not parse (blank lines are ignored) and uses List
as the factory.
Attributes
- Since
-
1.3
- Source
- Input.scala
Simplified form of readAll
that does not parse (blank lines are ignored), uses List
as the factory, and uses false
for the silent
argument.
Simplified form of readAll
that does not parse (blank lines are ignored), uses List
as the factory, and uses false
for the silent
argument.
Attributes
- Since
-
1.3
- Source
- Input.scala
The collection of files and subdirectories in a directory, in no particular order.
The collection of files and subdirectories in a directory, in no particular order.
Value parameters
- factory
-
a factory for the desired collection type.
- silent
-
if true, errors are ignored, and an empty collection is returned.
Attributes
- Throws
-
IllegalArgumentException
if the path is not a directory.
- Since
-
1.0
- Source
- files.scala
Parses a text source (sequence of lines) using a given parser to split each line. Lines that parse to an empty sequence (such as None
) are ignored. Encoding is UTF8.
Parses a text source (sequence of lines) using a given parser to split each line. Lines that parse to an empty sequence (such as None
) are ignored. Encoding is UTF8.
Value parameters
- in
-
the source to parse.
- parser
-
the parser to use; if omitted, each line is taken as a whole except blank lines, which are ignored.
Attributes
- Returns
-
an iterator of all the parts of all the lines; closing this iterator closes the underlying source.
- Since
-
1.3
- Source
- Input.scala
Writes the string into a destination. Nothing is added, unless when newLine = true
, which adds a final newline. Encoding is UTF8.
Writes the string into a destination. Nothing is added, unless when newLine = true
, which adds a final newline. Encoding is UTF8.
Value parameters
- newline
-
when true, adds a final newline to the output.
- out
-
the destination to write to.
Attributes
- Note
-
Uses
CharSequence
instead ofAny
to avoid accidental calls towrite
that were intended to bewriteAll
.If the destination is closable, this function closes it.
- Source
- Output.scala
Writes the string representations of a collection of values into a destination. The three arguments pre
, sep
, and post
are as in mkString
. Encoding is UTF8.
Writes the string representations of a collection of values into a destination. The three arguments pre
, sep
, and post
are as in mkString
. Encoding is UTF8.
Value parameters
- out
-
the destination to write to.
Attributes
- Note
-
If the destination is closable, this function closes it.
- Source
- Output.scala
Writes the string representations of a collection of values into a destination. Each value is followed by a newline, including the last.
Writes the string representations of a collection of values into a destination. Each value is followed by a newline, including the last.
Value parameters
- out
-
the destination to write to.
Attributes
- Note
-
If the destination is closable, this function closes it.
- Source
- Output.scala
Deprecated methods
Attributes
- Deprecated
-
[Since version 1.3]
- Source
- files.scala
Attributes
- Deprecated
-
[Since version 1.3]
- Source
- resources.scala
Attributes
- Deprecated
-
[Since version 1.3]
- Source
- files.scala
Concrete fields
Identity parsing. By using it as a parser
argument of readAll
, lines are returned unchanged.
Identity parsing. By using it as a parser
argument of readAll
, lines are returned unchanged.
Attributes
- Source
- Input.scala
Givens
Givens
Attributes
- Source
- Input.scala
Attributes
- Source
- Output.scala
Attributes
- Source
- Input.scala
Attributes
- Source
- Output.scala
Attributes
- Source
- Input.scala
Attributes
- Source
- Output.scala
Attributes
- Source
- Input.scala
Attributes
- Source
- Output.scala
Attributes
- Source
- Input.scala
Attributes
- Source
- Input.scala
Attributes
- Source
- Input.scala
Attributes
- Source
- Input.scala
Extensions
Extensions
Opens the input as a source.
Finds the given resource as a URL. This is simply a call to getClass.getResource
that throws MissingResourceException
instead of returning null
.
Finds the given resource as a URL. This is simply a call to getClass.getResource
that throws MissingResourceException
instead of returning null
.
Like getResource
, paths that start with a slash are absolute, and relative paths are relative to the full package name.
Attributes
- See also
-
java.lang.Class.getResource Throws java.util.MissingResourceException if the resource is not found.
- Since
-
1.0
- Source
- resources.scala
Finds the given resource as a URL. This is simply a call to getClass.getResource
that falls back to a default location instead of returning null
. Note that this findResource
variant does not throw MissingResourceException
.
Finds the given resource as a URL. This is simply a call to getClass.getResource
that falls back to a default location instead of returning null
. Note that this findResource
variant does not throw MissingResourceException
.
Like getResource
, paths that start with a slash are absolute, and relative paths are relative to the full package name. Paths are always treated as relative to the URI when the fallback is used.
Value parameters
- fallback
-
a fallback URI, which must be absolute.
Attributes
- See also
- Since
-
1.3
- Source
- resources.scala
Finds the given resource as a stream. If the resource is not found, then name.gz
is tried instead and, if found, opened as GZIP compressed data. (If name
already ends with .gz
, no attempt is made with a .gz.gz
name.)
Finds the given resource as a stream. If the resource is not found, then name.gz
is tried instead and, if found, opened as GZIP compressed data. (If name
already ends with .gz
, no attempt is made with a .gz.gz
name.)
Like getResource
, paths that start with a slash are absolute, and relative paths are relative to the full package name.
Attributes
- See also
-
java.lang.Class.getResource Throws java.util.MissingResourceException if the resource is not found.
- Since
-
1.3
- Source
- resources.scala
Finds the given resource as a stream. If the resource is not found, then name.gz
is tried instead. If neither is found locally, the fallback location is used to search for name.gz
first and, if unsuccessful, for name
. When a .gz
file is found, either locally or remotely, it is opened as GZIP compressed data. If name
already ends with .gz
, no attempt is made with a .gz.gz
name.
Finds the given resource as a stream. If the resource is not found, then name.gz
is tried instead. If neither is found locally, the fallback location is used to search for name.gz
first and, if unsuccessful, for name
. When a .gz
file is found, either locally or remotely, it is opened as GZIP compressed data. If name
already ends with .gz
, no attempt is made with a .gz.gz
name.
Like getClass.getResource
, paths that start with a slash are absolute, and relative paths are relative to the full package name.
Attributes
- See also
- Since
-
1.3
- Source
- resources.scala
Opens the output as a stream.