GZFile
GZFile
Properties
level
private int $level = -1encoding
private int $encoding = 'FORCE_GZIP'handle
private mixed $handleMethods
__construct
public __construct(mixed $file, ?Manager $manager): voidParameters
| Parameter | Type | Description |
|---|---|---|
$file | mixed | |
$manager | Manager |
setCompressionLevel
Sets the level of compression.
public setCompressionLevel(int $level): voidCan be given as 0 for no compression up to 9 for maximum compression.
If -1 is used, the default compression of the zlib library is used which is 6.
Parameters
| Parameter | Type | Description |
|---|---|---|
$level | int |
getCompressionLevel
Returns the current compression level setting.
public getCompressionLevel(): intCan be a value of 0 for no compression up to 9 for maximum compression.
If the value is -1, the default compression of the zlib library is being used, which is 6.
setEncoding
Set the current encoding for compress.
public setEncoding(int $encoding): boolParameters
| Parameter | Type | Description |
|---|---|---|
$encoding | int |
getEncoding
Returns the current gzencode encoding.
public getEncoding(): intopen
Open gz-file.
public open(string $mode = 'r'): mixedParameters
| Parameter | Type | Description |
|---|---|---|
$mode | string |
close
Close an open gz-file pointer.
public close(): boolread
Binary-safe gz-file read.
public read(int $length): stringFile::read() reads up to length bytes from the file pointer referenced by handle. Reading stops as soon as one of the following conditions is met:
- length bytes have been read
- EOF (end of file) is reached
- a packet becomes available or the socket timeout occurs (for network streams)
- if the stream is read buffered and it does not represent a plain file, at most one read of up to a number of bytes equal to the chunk size (usually 8192) is made; depending on the previously buffered data, the size of the returned data may be larger than the chunk size.
Parameters
| Parameter | Type | Description |
|---|---|---|
$length | int | up to length number of bytes read |
write
Binary-safe gz-file write.
public write(string $string, ?int $length): intFile::write() writes the contents of string to the file stream pointed to by handle.
Parameters
| Parameter | Type | Description |
|---|---|---|
$string | string | the string that is to be written |
$length | int | If the length argument is given, writing will stop after length bytes have been written or the end of string is reached, whichever comes first. Note that if the length argument is given, then the magic_quotes_runtime configuration option will be ignored and no slashes will be stripped from string. |
getc
Returns a character from the file pointer.
public getc(): stringgets
Returns a line from the file pointer.
public gets(?int $length): stringParameters
| Parameter | Type | Description |
|---|---|---|
$length | int |
getss
Returns a line from the file pointer and strips HTML tags.
public getss(string $allowableTags): stringParameters
| Parameter | Type | Description |
|---|---|---|
$allowableTags | string |
seek
Seeks to a position in the file.
public seek(int $offset, int $whence = 'SEEK_SET'): intParameters
| Parameter | Type | Description |
|---|---|---|
$offset | int | The offset. To move to a position before the end-of-file, you need to pass a negative value in offset and set whence to SEEK_END. |
$whence | int | whence values are: SEEK_SET - Set position equal to offset bytes. SEEK_CUR - Set position to current location plus offset. SEEK_END - Set position to end-of-file plus offset. |
tell
Returns the current position of the file read/write pointer.
public tell(): intrewind
Rewind the position of a file pointer.
public rewind(): boolSets the file position indicator for handle to the beginning of the file stream.
eof
Tests for end-of-file on a file pointer.
public eof(): boolget_contents
Returns the current contents of the file.
public get_contents(int $offset = -1, NULL $maxlen): voidParameters
| Parameter | Type | Description |
|---|---|---|
$offset | int | |
$maxlen | NULL |
putContents
Put contents directly writes data to the storage manager without storing it in the file object itself.
public putContents(string $data, bool $overwrite = true): ?intNOTE: This function is called internally to save data that has been updated in the file object.
Parameters
| Parameter | Type | Description |
|---|---|---|
$data | string | |
$overwrite | bool |
saveAs
Saves this file objects content to another file name.
public saveAs(string $filename, bool $overwrite): ?intParameters
| Parameter | Type | Description |
|---|---|---|
$filename | string | The filename to save as |
$overwrite | bool | Boolean flag to indicate that the destination should be overwritten if it exists |
Generated by Hazaar API Doc Generator on Wed, 07 Jan 2026 11:29:59 +0000