TextInputStream.Open

From Xojo Documentation

Shared Method

TextInputStream.Open(f As FolderItem) As TextInputStream

New in 2009r4

Opens the passed FolderItem to be read as a text file. Returns a TextInputStream. An IO error will trigger an IOException.

Notes

Reading from the file will begin at the start of the file. If you wish to read from any other point in the file, use the BytePosition property to move the read position.

This shared method replaces the deprecated FolderItem.OpenAsTextFile.

Example

Var f As FolderItem
Var t As TextInputStream
f = FolderItem.ShowOpenFileDialog("text") // file type defined in File Type Sets Editor
If f <> Nil Then
t = TextInputStream.Open(f)
t.Encoding = Encodings.UTF8 //specify encoding of input stream
TextArea1.Value = t.ReadAll
t.Close
End if