IO

introprog.IO
object IO

A module with input/output operations from/to the underlying file system.

Attributes

Source
IO.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
IO.type

Members list

Value members

Concrete methods

def appendLines(lines: Seq[String], fileName: String, enc: String): Unit

Appends lines to the text file fileName using encoding enc.

Appends lines to the text file fileName using encoding enc.

Value parameters

enc

the encoding of the file.

fileName

the path of the file.

lines

the lines to append to the file.

Attributes

Source
IO.scala
def appendString(text: String, fileName: String, enc: String): Unit

Appends string to the text file fileName using encoding enc.

Appends string to the text file fileName using encoding enc.

Value parameters

enc

the encoding of the file.

fileName

the path of the file.

text

the text to be appended to the file.

Attributes

Source
IO.scala
def createDirIfNotExist(dir: String): Boolean

Create a directory with name dir if it does not exist.

Create a directory with name dir if it does not exist.

Value parameters

dir

the path of the directory to be created.

Attributes

Returns

true if and only if the directory was created, along with all necessary parent directories otherwise false.

Source
IO.scala
def currentDir(): String

Gets the path of the current working directory.

Gets the path of the current working directory.

Attributes

Returns

the path of the current working directory.

Source
IO.scala
def delete(fileName: String): Unit

Deletes fileName.

Deletes fileName.

Value parameters

fileName

the path the file that will be deleted.

Attributes

Source
IO.scala
def isExisting(fileName: String): Boolean

Test if a file with name fileName exists.

Test if a file with name fileName exists.

Value parameters

fileName

the path of the file.

Attributes

Returns

true if the file exists else false.

Source
IO.scala
def list(dir: String): Vector[String]

Gets a sequence of file names in the directory dir.

Gets a sequence of file names in the directory dir.

Value parameters

dir

the path of the directory to be listed.

Attributes

Returns

a sequence of file names in the directory `dir

Source
IO.scala
def loadImage(fileName: String): Image

Load image from file.

Load image from file.

Value parameters

fileName

the path to the image that will be loaded.

Attributes

Source
IO.scala
def loadImage(file: File): Image

Load image from file.

Load image from file.

Value parameters

file

the file that will be loaded.

Attributes

Source
IO.scala
def loadLines(fileName: String, enc: String): Vector[String]

Load string lines from a text file called fileName using encoding enc.

Load string lines from a text file called fileName using encoding enc.

Value parameters

enc

the encoding of the file.

fileName

the path of the file.

Attributes

Source
IO.scala
def loadObject[T](fileName: String): T

Load a serialized object from a binary file called fileName.

Load a serialized object from a binary file called fileName.

Value parameters

fileName

the path of the file.

Attributes

Returns

the serialized object.

Source
IO.scala
def loadString(fileName: String, enc: String): String

Load a string from a text file called fileName using encoding enc.

Load a string from a text file called fileName using encoding enc.

Value parameters

enc

the encoding of the file.

fileName

the path of the file.

Attributes

Returns

the content loaded from the file.

Source
IO.scala
def move(from: String, to: String): Unit

Change name of file from, DANGER: silently replaces existing to.

Change name of file from, DANGER: silently replaces existing to.

Value parameters

from

the path of the file to be moved.

to

the path the file will be moved to.

Attributes

Source
IO.scala
def saveJPEG(img: Image, fileName: String, compression: Double): Unit

Save img to file as JPEG. Does not restore color of transparent pixels.

Save img to file as JPEG. Does not restore color of transparent pixels.

Value parameters

compression

the compression factor to use (0.0-1.0).

fileName

the path to save the image to, path/file.jpg or just path/file

image

the image to save.

Attributes

Source
IO.scala
def saveJPEG(img: Image, fileName: String): Unit

Save img to file as JPEG with a compression ratio of 0.75. Restore color of transparent pixels.

Save img to file as JPEG with a compression ratio of 0.75. Restore color of transparent pixels.

Value parameters

fileName

the path to save the image to, path/file.jpg or just path/file.

img

the image to save.

Attributes

Source
IO.scala
def saveLines(lines: Seq[String], fileName: String, enc: String): Unit

Save lines to a text file called fileName using encoding enc.

Save lines to a text file called fileName using encoding enc.

Value parameters

enc

the encoding of the file.

fileName

the path of the file.

lines

the lines to written to the file.

Attributes

Source
IO.scala
def saveObject[T](obj: T, fileName: String): Unit

Serialize obj to a binary file called fileName.

Serialize obj to a binary file called fileName.

Value parameters

fileName

the path of the file.

obj

the object to be serialized.

Attributes

Source
IO.scala
def savePNG(img: Image, fileName: String): Unit

Save img to file as PNG.

Save img to file as PNG.

Value parameters

fileName

the path to save the image to, path/file.png or just path/file.

img

the image to save.

Attributes

Source
IO.scala
def saveString(text: String, fileName: String, enc: String): Unit

Save text to a text file called fileName using encoding enc.

Save text to a text file called fileName using encoding enc.

Value parameters

enc

the encoding of the file.

fileName

the path of the file.

text

the text to be written to the file.

Attributes

Source
IO.scala
def userDir(): String

Gets the path of the current user's home directory.

Gets the path of the current user's home directory.

Attributes

Returns

the path of the current user's home directory.

Source
IO.scala