Player APIs (BrightScript & Ja...
...
Object Reference
File Objects

roReadFile

8min
object creation creating an roreadfile object opens the specified file for reading only object creation fails if the file does not exist createobject("roreadfile", filename as string) ifstreamread setreceiveeol(eol sequence as string) as void sets the eol sequence when reading from the stream the default eol character is cr lf, (ascii values 13 then 10) if you need to set this value to a non printing character, use the chr() global functions docid\ nsjxffr7olfgdwgjfebme readbyte() as integer reads a single byte from the stream, blocking if necessary if the eof is reached or there is an error condition, then a value less than 0 is returned readbyteifavailable() as integer reads a single byte from the stream if one is available if no bytes are available, it returns immediately a return value less than 0 indicates either that the eof has been reached or no byte is available readline() as string reads until it finds a complete end of the line sequence if it fails to find the sequence within 4096 bytes, then it returns the 4096 bytes that are found no data is discarded in this case readblock(size as integer) as string reads the specified number of bytes the number is limited to 65536 bytes in the event of an eof or an error, fewer bytes than requested will be returned any null bytes in the file will mask any further bytes ateof() as boolean returns true if an attempt has been made to read beyond the end of the file if the current position is at the end of the file, but no attempt has been made to read beyond it, this method will return false ifstreamseek seekabsolute(offset as integer) as void seeks the specified offset if the offset is beyond the end of the file, then the file will be extended upon the next write and any previously unoccupied space will be filled with null bytes seekrelative(offset as integer) as void seeks to the specified offset relative to the current position if the ultimate offset is beyond the end of the file, then the file will be extended as described in seekabsolute() seektoend() as void seeks to the end of the file currentposition() as integer retrieves the current position within the file