BrightSign HD2000 Object Reference Manual User Manual

Page 38

Advertising
background image

roReadFile, roCreateFile, roReadWriteFile, roAppendFile
(HD2000only)

These objects provide file I/O functionality on the HD2000 using the ifStreamRead, ifStreamSend,
ifStreamSeek, and ifFile interfaces.

Creating an roReadFile object opens the specified file for reading only. Object creation fails if the file does
not exist. roReadFile implements ifStreamSeek and ifStreamRead.
 CreateObject("roReadFile", rotSTRING filename)

Creating an roCreateFile object opens an existing file or creates a new file. If the file exists, it is truncated
to zero size. roCreateFile implements ifStreamSeek, ifStreamRead, ifStreamSend, and ifFile.
 CreateObject("roCreateFile", rotSTRING filename)

Creating an roReadWriteFile object opens an existing file for both reading and writing. Object creation
fails if the file does not exist. The current position is set to the beginning of the file. roReadWriteFile
implements ifStreamSeek, ifStreamRead, ifStreamSend, and ifFile.
 CreateObject("roReadWriteFile", rotSTRING filename)

Creating an roAppendFile object opens an existing file or creates a new file The current position is set to
the end of the file and all writes are made to the end of the file. roAppendFile implements ifStreamSend,
and ifFile.
 CreateObject("roAppendFile", rotSTRING filename)

The ifStreamRead interface provides:
 rotVOID SetReceiveEol(rotSTRING eol_sequence)

o

Set the EOL sequence when reading from the stream.

 rotINT32 ReadByte()

o

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.

 rotINT32 ReadByteIfAvailable()

o

Reads a single byte from the stream if one is available. If none is available, it returns

immediately. A return value less than 0 indicates either that the EOF has been reached or no
byte is available.

 rotSTRING ReadLine()

o

Reads until it finds a complete end of line sequence. If it fails to find the sequence within 4096

bytes, then it returns the 4096 bytes found. No data is discarded in this case.

 rotSTRING ReadBlock(rotINT32 size)

o

Reads the specified number of bytes. Size 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.

 rotBOOL AtEof()

o

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.


The ifStreamSend interface provides:
 rotVOID SetSendEol(rotSTRING eol_sequence)

o

Set the EOL sequence when writing to the stream.

 rotVOID SendByte(rotINT32 byte)

o

Writes the specified byte to the stream.

 rotVOID SendLine(rotSTRING string)

o

Writes the specified characters to the stream followed by the current EOL sequence.

38

Advertising
This manual is related to the following products: