-
Notifications
You must be signed in to change notification settings - Fork 5
kiwi.io.FileReader
Nikos Siatras edited this page Sep 22, 2022
·
8 revisions
The FileReader object Reads text from character files using a default buffer size. Decoding from bytes to characters uses either a specified charset or the FreeBasic's default charset (Ascii).
The FileReader class exists in the kiwi/io/FileWriter.bi file.
| Method | Description |
|---|---|
| FileReader.OpenStream() | Opens a file Input Stream and returns true if file exists and can be read |
| FileReader.CloseStream() | Closes the file Input Stream |
| FileReader.read() | Reads a single character. Returns rhe character read, or -1 if the end of the stream has been reached |
| FileReader.getEncoding() | Returns the name of the character encoding being used by this stream. |
| FileReader.reset() | Resets the stream and the file can be readed again. |
#include once "kiwi\kiwi.bi"
#include once "kiwi\io.bi" ' Include Kiwi's IO package
' Initialize the file to read and a FileReader
Dim myFile as File = File("C:\Users\nsiat\Desktop\Test.txt")
Dim reader as FileReader = FileReader(myFile, Charset.UTF8) ' Use UTF8 charset
' Try to open the file
if reader.OpenStream() = true then
' Read each char of the File and print it on screen
Dim c as Integer = reader.read()
while (c <> -1)
print WChr(c);
c = reader.read()
wend
' Close the File
reader.CloseStream()
else
print "Unable to open the file! Check if file is saved as 'UTF-8-BOM'"
end if - MySQL/MariaDB - Coming to v1.0.2
- ArrayList
- Comparator
- HashMap - Coming to v1.0.2
- Queue