-
Notifications
You must be signed in to change notification settings - Fork 5
kiwi.io.FileReader
Nikos Siatras edited this page Sep 20, 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 FreebBasic's default charset (Ascii).
| Method | Description |
|---|---|
| FileReader.OpenFile() | Opens a file Input Stream and returns true if file exists and can be read |
| FileReader.CloseFile() | 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
Dim filePath as String = "C:\Users\nsiat\Desktop\Test.txt"
' Create a FileReader in order to read out file
Dim reader as FileReader = FileReader(filePath)
' Read each char of the File and print it on screen
reader.OpenFile()
Dim c as Integer = reader.read()
while (c <> -1)
print WChr(c);
c = reader.read()
wend
reader.CloseFile()#include once "kiwi\kiwi.bi"
#include once "kiwi\io.bi" ' Include Kiwi's IO package
' Create an instance of a new File
Dim myFile as File = File("C:\Users\nsiat\Desktop\Test.txt")
' Initialize the charset to use during file read
Dim charsetToUse as Charset = Charset.forName("utf-8")
' Create a FileReader
Dim reader as FileReader = FileReader(myFile, charsetToUse)
' Try to open the file
if reader.OpenFile() = 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.CloseFile()
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