This object provides convenience methods to create an iterable representation of a source file.
Attributes
- Companion
- class
- Source
- Source.scala
- Graph
-
- Supertypes
- Self type
-
Source.type
Members list
Value members
Concrete methods
Reads data from inputStream with a buffered reader, using the encoding in implicit parameter codec.
Reads data from inputStream with a buffered reader, using the encoding in implicit parameter codec.
Value parameters
- bufferSize
-
buffer size (defaults to Source.DefaultBufSize)
- close
-
a () => Unit method which closes the stream (if unset, close() will do nothing)
- codec
-
(implicit) a scala.io.Codec specifying behavior (defaults to Codec.default)
- inputStream
-
the input stream from which to read
- reset
-
a () => Source which resets the stream (if unset, reset() will throw an Exception)
Attributes
- Returns
-
a
BufferedSourcereading frominputStreamwith the given buffer size - Source
- Source.scala
Creates a Source from array of bytes, decoding the bytes according to codec.
Creates a Source from array of bytes, decoding the bytes according to codec.
Value parameters
- bytes
-
the array of bytes to decode into characters
- codec
-
the implicit codec used for character encoding
Attributes
- Returns
-
a
Sourcethat yields the characters decoded frombytesusingcodec - Source
- Source.scala
Creates a Source instance from a single character.
Creates a Source instance from a single character.
Value parameters
- c
-
the character to use as the source content
Attributes
- Returns
-
a
Sourcethat yields the single characterc - Source
- Source.scala
Creates Source from array of characters, with empty description.
Creates Source from array of characters, with empty description.
Value parameters
- chars
-
the array of characters to use as the source content
Attributes
- Returns
-
a
Sourcethat yields the characters fromchars - Source
- Source.scala
Creates Source from file with given name, setting its description to filename.
Creates Source from file with given name, setting its description to filename.
Value parameters
- codec
-
the implicit codec used for character encoding
- name
-
the name of the file to read
Attributes
- Returns
-
a
BufferedSourcereading from the named file, described by its filename - Source
- Source.scala
Creates Source from file with given name, using given encoding, setting its description to filename.
Creates Source from file with given name, using given encoding, setting its description to filename.
Value parameters
- enc
-
the name of the character encoding to use
- name
-
the name of the file to read
Attributes
- Returns
-
a
BufferedSourcereading from the named file with the given encoding - Source
- Source.scala
Creates source from file with given file URI.
Creates source from file with given file URI.
Value parameters
- codec
-
the implicit codec used for character encoding
- uri
-
the file URI to read from
Attributes
- Returns
-
a
BufferedSourcereading from the file referenced byuri - Source
- Source.scala
Creates Source from file with given file: URI
Creates Source from file with given file: URI
Value parameters
- enc
-
the name of the character encoding to use
- uri
-
the file URI to read from
Attributes
- Returns
-
a
BufferedSourcereading from the file referenced byuriwith the given encoding - Source
- Source.scala
Creates Source from file, using default character encoding, setting its description to filename.
Creates Source from file, using default character encoding, setting its description to filename.
Value parameters
- codec
-
the implicit codec used for character encoding
- file
-
the file to read from
Attributes
- Returns
-
a
BufferedSourcereading fromfilewith the default buffer size - Source
- Source.scala
same as fromFile(file, enc, Source.DefaultBufSize)
same as fromFile(file, enc, Source.DefaultBufSize)
Value parameters
- enc
-
the name of the character encoding to use
- file
-
the file to read from
Attributes
- Returns
-
a
BufferedSourcereading fromfilewith the given encoding - Source
- Source.scala
Attributes
- Source
- Source.scala
Creates Source from file, using given character encoding, setting its description to filename. Input is buffered in a buffer of size bufferSize.
Creates Source from file, using given character encoding, setting its description to filename. Input is buffered in a buffer of size bufferSize.
Value parameters
- bufferSize
-
the size of the input buffer, in characters
- codec
-
the implicit codec used for character encoding
- file
-
the file to read from
Attributes
- Returns
-
a
BufferedSourcereading fromfilewith the given buffer size, described by the file's absolute path - Source
- Source.scala
Attributes
- Source
- Source.scala
Attributes
- Source
- Source.scala
Creates a Source from an Iterable.
Creates a Source from an Iterable.
Value parameters
- iterable
-
the Iterable
Attributes
- Returns
-
the Source
- Source
- Source.scala
Reads data from a classpath resource, using either a context classloader (default) or a passed one.
Reads data from a classpath resource, using either a context classloader (default) or a passed one.
Value parameters
- classLoader
-
classloader to be used, or context classloader if not specified
- codec
-
the implicit codec used for character encoding
- resource
-
name of the resource to load from the classpath
Attributes
- Returns
-
the buffered source
- Source
- Source.scala
Creates Source from a String, with no description.
Creates Source from a String, with no description.
Value parameters
- s
-
the string to use as the source content
Attributes
- Returns
-
a
Sourcethat yields the characters ofs - Source
- Source.scala
creates Source from file with given file: URI
creates Source from file with given file: URI
Value parameters
- codec
-
the implicit codec used for character encoding
- uri
-
the file URI to read from
Attributes
- Returns
-
a
BufferedSourcereading from the file referenced byuri - Source
- Source.scala
Same as fromURL(new URL(s))(Codec(enc))
Same as fromURL(new URL(s))(Codec(enc))
Value parameters
- enc
-
the name of the character encoding to use
- s
-
the URL string to read from
Attributes
- Returns
-
a
BufferedSourcereading from the URL given byswith the given encoding - Source
- Source.scala
Same as fromURL(new URL(s))
Same as fromURL(new URL(s))
Value parameters
- codec
-
the implicit codec used for character encoding
- s
-
the URL string to read from
Attributes
- Returns
-
a
BufferedSourcereading from the URL given bys - Source
- Source.scala
Same as fromInputStream(url.openStream())(Codec(enc))
Same as fromInputStream(url.openStream())(Codec(enc))
Value parameters
- enc
-
the name of the character encoding to use
- url
-
the URL to read from
Attributes
- Returns
-
a
BufferedSourcereading from the stream opened onurlwith the given encoding - Source
- Source.scala
Same as fromInputStream(url.openStream())(codec)
Same as fromInputStream(url.openStream())(codec)
Value parameters
- codec
-
the implicit codec used for character encoding
- url
-
the URL to read from
Attributes
- Returns
-
a
BufferedSourcereading from the stream opened onurl - Source
- Source.scala
Creates a Source from System.in.
Deprecated methods
Creates a Source from array of bytes, assuming one byte per character (ISO-8859-1 encoding.)
Creates a Source from array of bytes, assuming one byte per character (ISO-8859-1 encoding.)
Attributes
- Deprecated
-
[Since version 2.13.9]Use `fromBytes` and specify an encoding - Source
- Source.scala
Concrete fields
Attributes
- Source
- Source.scala