scala.io
object Source

[source: `scala/io/Source.scala`]

`` `object` Source
  `extends` AnyRef

  This object provides convenience methods to create an iterable representation of a source file.

Author
  Burak Emir
Version
  1.0, 19/08/2004

Method Summary
`def` | fromBytes (bytes : Array[Byte]) : Source Creates a `Source` instance from the given array of bytes, with empty description.
`def` | fromBytes (bytes : Array[Byte], enc : String) : Source Creates Source from array of bytes with given encoding, with empty description.
`def` | fromChar (c : Char) : Source Creates a `Source` instance from a single character.
`def` | fromChars (chars : Array[Char]) : Source creates Source from array of characters, with empty description.
`def` | fromFile (file : File, enc : String) : Source Creates Source from file, using given character encoding, setting its description to filename.
`def` | fromFile (name : String) : Source creates Source from file with given name, setting its description to filename.
`def` | fromFile (file : File) : Source creates Source from file, using default character encoding, setting its description to filename.
`def` | fromFile (name : String, enc : String) : Source creates Source from file with given name, using given encoding, setting its description to filename.
`def` | fromFile (uri : URI) : Source creates Source from file with given file: URI
`def` | fromInputStream (istream : InputStream, enc : String, maxlen : Option[Int]) : Source reads data from inputstream into a byte array, and calls fromBytes with given encoding. If maxlen is given, reads not more bytes than maxlen. if maxlen was not given, or was <= 0, then whole inputstream is read and closed afterwards.
`def` | fromInputStream (is : InputStream) : Source same as fromInputStream(is, "utf-8", None)
`def` | fromInputStream (is : InputStream, enc : String) : Source same as fromInputStream(is, enc, None)
`def` | fromString (s : String) : Source creates Source from string, with empty description.
`def` | fromURL (url : URL) : Source
`def` | fromURL (s : String) : Source
`def` | setFileDescriptor (file : File, s : Source) : Source

Methods inherited from AnyRef
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized

Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf

Method Details

`` `def` fromBytes(bytes : Array[Byte]) : Source

  Creates a `Source` instance from the given array of bytes, with empty description.

Parameters
  `bytes -` ...
Returns
  the created `Source` instance.

`` `def` fromBytes(bytes : Array[Byte], enc : String) : Source

  Creates Source from array of bytes with given encoding, with empty description.

Parameters
  `bytes -` ...
  `enc -` ...
Returns
  ...

`` `def` fromChar(c : Char) : Source

  Creates a `Source` instance from a single character.

Parameters
  `c -` ...
Returns
  the create `Source` instance.

`` `def` fromChars(chars : Array[Char]) : Source

  creates Source from array of characters, with empty description.

Parameters
  `chars -` ...
Returns
  ...

`` `def` fromString(s : String) : Source

  creates Source from string, with empty description.

Parameters
  `s -` ...
Returns
  ...

`` `def` fromFile(name : String) : Source

  creates Source from file with given name, setting its description to filename.

`` `def` fromFile(name : String, enc : String) : Source

  creates Source from file with given name, using given encoding, setting its description to filename.

`` `def` fromFile(uri : URI) : Source

  creates Source from file with given file: URI

`` `def` fromFile(file : File) : Source

  creates Source from file, using default character encoding, setting its description to filename.

`` `def` fromFile(file : File, enc : String) : Source

  Creates Source from file, using given character encoding, setting its description to filename.

Parameters
  `file -` ...
  `enc -` ...
Returns
  ...

`` `def` setFileDescriptor(file : File, s : Source) : Source

Parameters
  `file -` ...
  `s -` ...
Returns
  ...

`` `def` fromURL(s : String) : Source

Parameters
  `s -` ...
Returns
  ...

`` `def` fromURL(url : URL) : Source

Parameters
  `url -` ...
Returns
  ...

`` `def` fromInputStream(istream : InputStream, enc : String, maxlen : Option[Int]) : Source

  reads data from inputstream into a byte array, and calls fromBytes with given encoding. If maxlen is given, reads not more bytes than maxlen. if maxlen was not given, or was <= 0, then whole inputstream is read and closed afterwards.

Parameters
  `istream -` the input stream from which to read
  `enc -` the encoding to apply to the bytes
  `maxlen -` optionally, a positive int specifying maximum number of bytes to read

`` `def` fromInputStream(is : InputStream, enc : String) : Source

  same as fromInputStream(is, enc, None)

`` `def` fromInputStream(is : InputStream) : Source

  same as fromInputStream(is, "utf-8", None)