Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
General
»
compact files
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
Forum Rules
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
WIKI Timeout issues
Please read here if you have trouble connecting to the wiki
Recent
controls.lpr(731,15) Erro...
by
dseligo
[
Today
at 03:31:46 pm]
[Solved] Can't install mo...
by
lainz
[
Today
at 03:28:41 pm]
Questions about GUID decl...
by
Thaddy
[
Today
at 03:24:47 pm]
internal Compiler Error
by
Thaddy
[
Today
at 03:21:04 pm]
Reference to bsSolid give...
by
wp
[
Today
at 03:09:17 pm]
[Solved]Open Project fail...
by
cdbc
[
Today
at 03:06:30 pm]
Popup Form to close when ...
by
Thaddy
[
Today
at 02:10:55 pm]
Spikey Splat Creatures fr...
by
Boleeman
[
Today
at 01:19:35 pm]
Amigo programming languag...
by
paxscript
[
Today
at 12:20:33 pm]
Input Chinese using Micro...
by
momigo
[
Today
at 10:50:40 am]
Ballet of Lines and Dots ...
by
Boleeman
[
Today
at 09:19:59 am]
Using icons in own open s...
by
paule32
[
Today
at 08:14:05 am]
ChatGPT and ObjectPascal ...
by
Thaddy
[
Today
at 07:56:29 am]
control '' has no parent
by
Thaddy
[
Today
at 07:23:07 am]
Converting excel to csv -...
by
andresayang
[
Today
at 01:44:28 am]
Persistent MacOS Arm M ch...
by
BVale
[
Today
at 12:05:12 am]
Original game - 3 Cross
by
TBMan
[
Today
at 12:01:24 am]
Exporting larger files
by
Guser979
[July 08, 2025, 11:55:04 pm]
json goes RichMemo
by
Thaddy
[July 08, 2025, 08:52:20 pm]
MDI ChildForm
by
CharlyTango
[July 08, 2025, 08:41:25 pm]
Fern Leaf Fractal (Recurs...
by
Lulu
[July 08, 2025, 07:54:23 pm]
Trouble compiling fpc for...
by
ermok
[July 08, 2025, 06:21:06 pm]
Feature request: hard typ...
by
440bx
[July 08, 2025, 05:53:44 pm]
Lazarus 4 and TAChart Hin...
by
Nicole
[July 08, 2025, 05:13:38 pm]
Pappas Chain Ring: Not Ro...
by
Boleeman
[July 08, 2025, 01:06:20 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: compact files (Read 2272 times)
fabiopesaju
Jr. Member
Posts: 96
compact files
«
on:
December 28, 2018, 06:01:42 pm »
hello...
please, about compaction, which component can you suggest me? (for pure text files)
Logged
Bart
Hero Member
Posts: 5575
Re: compact files
«
Reply #1 on:
December 28, 2018, 06:29:21 pm »
Zip?
Fc has libs for it.
Bart
Logged
lucamar
Hero Member
Posts: 4219
Re: compact files
«
Reply #2 on:
December 28, 2018, 06:45:38 pm »
Customary links:
paszlib
FreePascalArchivePackage
bzip2lib
ZLib
Have fun!
Logged
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!)
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.
wp
Hero Member
Posts: 12908
Re: compact files
«
Reply #3 on:
December 28, 2018, 07:00:22 pm »
Sample code here:
http://forum.lazarus-ide.org/index.php/topic,39634.msg272704.html#msg272704
Logged
User137
Hero Member
Posts: 1791
Re: compact files
«
Reply #4 on:
December 29, 2018, 07:54:01 am »
I always considered the stream approach best:
https://www.freepascal.org/docs-html/fcl/zstream/index.html
Some code example:
https://github.com/Zaflis/nxpascal/blob/master/src/nxData.pas
The principle of the class was to keep a whole gameworld loaded in memory at the time. But only the active areas are decompressed. I have tested that working on a realtime game, compressing and decompressing tile chunks with threading as camera moves rapidly. It actually was far smoother with threads, the app doesn't lock up waiting for the compression. Even a few milliseconds may be noticeable.
You can compress/decompress a TStringList when using:
https://www.freepascal.org/docs-html/rtl/classes/tstrings.loadfromstream.html
But you might need TMemoryStream and/or TFileStream in the process. But it's far better than needing to save uncompressed file to disk, and then load it back in for zipping and resaving. Depends on what you intended to do...
«
Last Edit: December 29, 2018, 11:22:42 am by User137
»
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
General
»
compact files
TinyPortal
© 2005-2018