Class FileReader

Class used to read files from filesystem.

Implemented Interfaces

InputStream

Constructors

Methods


(fileReader) new fileReader <string filePath>

Opens a file for reading. The current file position is at the beginning of the file.

Parameters

Exceptions

Example

main
  FileReader fr = null
  try
    fr = new FileReader "image.png"
  catch IOException e
    print "Opening of the file failed."
                

set position to <int newPos>

Moves the current file position to the newPos.

Parameters

Exceptions

Example

main
  FileReader fr = new FileReader "image.png"
  try
    fr.set position to 1000
  catch IOException e
    print "Tried to set invalid position."
                

(int) get position

Get the current file position.

Return value

Exceptions

Example

main
  FileReader fr = new FileReader "image.png"
  int filePosition = fr.get position

  print "File is at position: " & filePosition
                

(int) get size

Get the size of the file.

Return value

Exceptions

Example

main
  FileReader fr = new FileReader "image.png"
  int fileSize = fr.get size

  print "Size of the file is: " & fileSize