QLZFileStream component, version 1.0.0
Copyright © 2001 Pavel "EvilOne" Minayev


General info

Class name: QLZFileStream

Base class: QObject


Description:

QLZFileStream component allows you to work with files compressed with Microsoft COMPRESS.EXE utility (included in this package) - the one that was used to compress MS-DOS 6.22 and Windows 3.1 distributives, replacing last character of file with underscore. Main advantage of this library is that it makes it possible to work with compressed files as if they were uncompressed and read-only; in other words, you can read arbitrary blocks of data from file, move file pointer to anywhere you want... The component was written to mimic QFileStream interface as close as possible, but due to limitations of Rapid-Q the match is not absolute. Anyhow, properties and methods provided by the component are enough to do whatever you could do with QFileStream. Besides, I think that you'll prefer some changed things over those seen in QFileStream (like new Read syntax).


Properties:
Methods:

Properties

EOF

Definition: EOF AS LONG

Access: read-only

Description:

Contains 0 if file pointer is at the very end of file, non-zero value otherwise.


Handle

Definition: Handle AS LONG

Access: read-only

Description:

Contains file handle returned by LZOpenFile function; can be used with LZ* family of Win32 API functions.


Position

Definition: Position AS LONG

Access: read/write

Description:

Contains opened file pointer position, counting from beginning of file. Assigning a new value to property will change the position.


Size

Definition: Position AS LONG

Access: read-only

Description:

Contains opened file size.



Methods

Close

Definition: SUB Close

Description:

Closes previously opened file.


Open

Definition: FUNCTION Open(FileName AS STRING) AS LONG

Description:

Opens the file FileName. File is always opened for reading only. If operation is successful, non-zero value is returned. If an error occures (for example, if file wasn't found), the result is 0.


Read

Definition: FUNCTION Read(Buffer AS LONG, Count AS LONG) AS LONG

Description:

Reads Count bytes from file into memory location pointed by Buffer. You may use VARPTR to get the address of variable to read into it. This function is the only way to read UDTs, because ReadUDT is not supported. The return value is the number of bytes actually read, or 0 at end of file.


Read%

Definition: FUNCTION Read% AS SHORT

Description:

Reads a SHORT (2-byte signed integer) value from file and returns it. There is no way to check if operation was successful; if you want to be sure, check EOF property every time before using this function.


Read&

Definition: FUNCTION Read& AS LONG

Description:

Reads a LONG (4-byte signed integer) value from file and returns it. There is no way to check if operation was successful; if you want to be sure, check EOF property every time before using this function.


Read?

Definition: FUNCTION Read? AS BYTE

Description:

Reads a BYTE (single-byte unsigned integer) value from file and returns it. There is no way to check if operation was successful; if you want to be sure, check EOF property every time before using this function.


Read??

Definition: FUNCTION Read?? AS WORD

Description:

Reads a WORD (2-byte unsigned integer) value from file and returns it. There is no way to check if operation was successful; if you want to be sure, check EOF property every time before using this function.


Read!

Definition: FUNCTION Read! AS SINGLE

Description:

Reads a SINGLE (4-byte floating-point) value from file and returns it. There is no way to check if operation was successful; if you want to be sure, check EOF property every time before using this function.


Read#

Definition: FUNCTION Read# AS DOUBLE

Description:

Reads a DOUBLE (8-byte floating-point) value from file and returns it. There is no way to check if operation was successful; if you want to be sure, check EOF property every time before using this function.


Read$

Definition: FUNCTION Read$(Length AS LONG) AS STRING

Description:

Reads a string of length Length from file and returns it. There is no way to check if operation was successful; if you want to be sure, check EOF property every time before using this function.


ReadBinStr

Definition: FUNCTION ReadBinStr(Length AS LONG) AS STRING

Description:

The same as Read$ method. Provided for compatibility with QFileStream.


ReadLine

Definition: FUNCTION ReadLine AS STRING

Description:
Reads a line from file and returnes. The lines are supposed to be terminated either by CR/LF pair or by single LF - thus, files where lines are separated by single CR cannot be read with this function. There is no way to check if operation was successful; if you want to be sure, check EOF property every time before using this function.


ReadNum

Definition: FUNCTION ReadNum(Num AS LONG) AS DOUBLE

Description:
Reads a number from file and returns it; actual number of bytes read depends on the value of Num, which can be Num_SHORT, Num_LONG, Num_BYTE, Num_WORD, Num_SINGLE or Num_DOUBLE. The names are self- explanatory. There is no way to check if operation was successful; if you want to be sure, check EOF property every time before using this function. This function is provided for compatibility with QFileStream only, it's recommended that you use the Read* family of functions instead.


ReadStr

Definition: FUNCTION ReadStr(Length AS LONG) AS STRING

Description:

The same as Read$ method. Provided for compatibility with QFileStream.


Seek

Definition: SUB Seek(Offset AS LONG, From AS LONG)

Description:

Moves file pointer to position Offset, counting from beginning of file if From equals soFromBeginning, from end of file if From equals soFromEnd, or from current position if From equals soFromCurrent. In last two cases, negative offsets are allowed.