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
Recent
BS Controls – Silly Compo...
by
Xenno
[
Today
at 06:53:52 am]
Adding persistent fields ...
by
paweld
[
Today
at 06:11:57 am]
Font Name properties
by
dsiders
[
Today
at 05:37:19 am]
QGradientTrackPanel: A Fu...
by
Ed78z
[
Today
at 01:24:17 am]
Solved: Picture Framer (R...
by
Boleeman
[
Today
at 12:20:27 am]
Why does Free Pascal use ...
by
creaothceann
[August 16, 2026, 11:26:45 pm]
Lazarus Vs Codetyphon
by
BSaidus
[August 16, 2026, 09:59:46 pm]
Proper name for free meth...
by
jamie
[August 16, 2026, 09:54:48 pm]
MR - DebuggerIntf for ter...
by
Martin_fr
[August 16, 2026, 08:21:29 pm]
Is it possible to communi...
by
Warfley
[August 16, 2026, 08:15:43 pm]
array values as reference
by
jamie
[August 16, 2026, 07:58:57 pm]
LRS Explorer
by
Xenno
[August 16, 2026, 07:27:54 pm]
[Solved] The use of EXIT ...
by
440bx
[August 16, 2026, 07:27:20 pm]
TEDit PasswordChar not wo...
by
Hansaplast
[August 16, 2026, 05:19:01 pm]
Which Linux version
by
cdbc
[August 15, 2026, 08:28:37 pm]
[Qt5/Qt6] JPSupport-Qt: J...
by
shortcut
[August 15, 2026, 08:19:29 pm]
FpDebug: Bugs and API gap...
by
Martin_fr
[August 15, 2026, 08:07:50 pm]
Synedit wordwrap
by
Martin_fr
[August 15, 2026, 05:37:57 pm]
TlsLib4Pascal
by
Thaddy
[August 15, 2026, 05:27:52 pm]
Unleashed Pascal (async/a...
by
chamfay
[August 15, 2026, 10:35:09 am]
TDWEdit
by
docno
[August 15, 2026, 10:12:10 am]
var vs out (including "co...
by
440bx
[August 15, 2026, 08:42:28 am]
Local AI LLM Wrapper Demo...
by
edwinyzh
[August 15, 2026, 05:30:15 am]
Trndi 16 is released
by
slicke
[August 15, 2026, 03:06:44 am]
Clean up and build
by
n7800
[August 14, 2026, 11:03:28 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: compact files (Read 2449 times)
fabiopesaju
Full Member
Posts: 100
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: 5757
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: 4217
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: 13649
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