Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

GZipFileMBS.Adler32(start as UInt32, data as string) as UInt32
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Compression MBS Compression Plugin 4.2 Yes Yes Yes Yes No
Function: Calculates a 32bit Adler Checksum about a given string.
Notes:
Set start to 0 for the first call.
Later you can pass the result as the new start value to add data to your checksum.

This function is part of the zlib library and given as a free utility function to this class.

Feedback, Comments & Corrections

GZipFileMBS.Close
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Compression MBS Compression Plugin 4.2 Yes Yes Yes Yes No
Function: The destructor.
Notes: There is no need to call this method except you want to free all resources of this object now without waiting for Realbasic to do it for you.

Feedback, Comments & Corrections

GZipFileMBS.CloseForString as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Compression MBS Compression Plugin 11.1 Yes Yes Yes Yes No
Function: Closes the file and returns the string.
Example:
Function GZIPStringWriteMBS(data as string) As string
dim g as new GZipFileMBS

if g.CreateForString then
g.Write data

Return g.CloseForString
end if
End Function
Notes:
Only for use with CreateForString function.
Returns empty string on any error.

Feedback, Comments & Corrections

GZipFileMBS.CRC32(start as UInt32, data as string) as UInt32
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Compression MBS Compression Plugin 4.2 Yes Yes Yes Yes No
Function: Calculates a 32bit Checksum about a given string.
Notes:
Set start to 0 for the first call.
Later you can pass the result as the new start value to add data to your checksum.

This function is part of the zlib library and given as a free utility function to this class.

Feedback, Comments & Corrections

GZipFileMBS.CreateForString as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Compression MBS Compression Plugin 11.1 Yes Yes Yes Yes No
Function: Creates a new gzip file in memory.
Example:
Function GZIPStringWriteMBS(data as string) As string
dim g as new GZipFileMBS

if g.CreateForString then
g.Write data

Return g.CloseForString
end if
End Function
Notes:
Use with the CloseForString method to compress data in memory.
Returns false on any error and true on success.

Feedback, Comments & Corrections

GZipFileMBS.Flush(flush as Integer)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Compression MBS Compression Plugin 4.2 Yes Yes Yes Yes No
Function: Flushes all pending output into the compressed file.
Notes:
The parameter flush is as in the zlib deflate() function.
Lasterror is set.
Flush should be called only when strictly necessary because it can degrade compression.

Feedback, Comments & Corrections

GZipFileMBS.Open(file as folderitem, mode as string) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Compression MBS Compression Plugin 4.2 Yes Yes Yes Yes No
Function: Opens a gzip (.gz) file for reading or writing.
Notes:
The mode parameter is as in fopen ("rb" read binary or "wb" for write binary) but can also include a compression level ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman only compression as in "wb1h".

Open can be used to read a file which is not in gzip format; in this case Read will directly read from the file without decompression.

Open returns NULL if the file could not be opened or if there was insufficient memory to allocate the (de)compression state; errno can be checked to distinguish the two cases (if errno is zero, the zlib error is Z_MEM_ERROR).

Returns false on any error and true on success.

Feedback, Comments & Corrections

GZipFileMBS.OpenString(data as string) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Compression MBS Compression Plugin 9.6 Yes Yes Yes Yes No
Function: Opens a gzip (.gz) file for reading from a file.
Example:
Function GZipStringReadMBS(compressedData as string) As string
dim g as new GZipFileMBS

const BlockSize=1000000

if g.OpenString(compressedData) then

dim parts(-1) as string

while not g.eof
dim s as string=g.Read(BlockSize)
parts.Append s
wend

Return Join(parts,"")
end if
End Function
Notes: Same as Open, but reading from the given string.

Feedback, Comments & Corrections

GZipFileMBS.Read(ByteCount as Int64) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Compression MBS Compression Plugin 4.2 Yes Yes Yes Yes No
Function: Reads the given number of bytes into a string.
Notes:
Returns "" on any error.
May return less bytes than requested.
Lasterror is set.

Feedback, Comments & Corrections

GZipFileMBS.ReadByte as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Compression MBS Compression Plugin 4.2 Yes Yes Yes Yes No
Function: Reads one byte from the file.

Feedback, Comments & Corrections

GZipFileMBS.ReadData(ByteCount as Int64) as Memoryblock
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Compression MBS Compression Plugin 15.0 Yes Yes Yes Yes No
Function: Reads the given number of bytes into a memoryblock.
Notes:
Returns nil on any error.
May return less bytes than requested.
Lasterror is set.

Feedback, Comments & Corrections

GZipFileMBS.Rewind
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Compression MBS Compression Plugin 4.2 Yes Yes Yes Yes No
Function: Moves the file position for reading files to the file start.
Notes: Equal to: position=0

Feedback, Comments & Corrections

GZipFileMBS.SetParameter(level as Integer, strategy as Integer)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Compression MBS Compression Plugin 4.2 Yes Yes Yes Yes No
Function: Dynamically update the compression level or strategy.
Notes:
Lasterror is set.

Possible values:
FILTERED 1
HUFFMAN_ONLY 2
DEFAULT_STRATEGY 0

Feedback, Comments & Corrections

GZipFileMBS.Write(data as Memoryblock)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Compression MBS Compression Plugin 15.0 Yes Yes Yes Yes No
Function: Writes a Memoryblock to a file.
Notes: Lasterror is set.

See also:

Feedback, Comments & Corrections

GZipFileMBS.Write(data as string)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Compression MBS Compression Plugin 4.2 Yes Yes Yes Yes No
Function: Writes a string to a file.
Notes:
Note that encoding can make trouble as the raw bytes from the string are written.
Lasterror is set.

See also:

Feedback, Comments & Corrections

GZipFileMBS.WriteByte(data as Integer)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Compression MBS Compression Plugin 4.2 Yes Yes Yes Yes No
Function: Writes one byte to the file.

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS Compression Plugin.




Links
MBS Xojo tutorial videos