Byterage released on google code
One of my personal units for working with memory, files and buffers in general: byterage, was today released into the wild on Google code (SVN only).
Byterage is an object pascal class library designed to remove some of the limitations of streams, as well as simplify memory allocation and manipulation. It provides an abstract baseclass with storage agnostic mechanisms for allocating, scaling, inserting, removing and otherwise manipulate a data buffer. In other words, the same API applies to both memory, disk and stream storage. All derived buffer types supports the same flexible methods:
A typical example of use is if you need to insert large amounts of data into an already existing file or buffer, or indeed remove a chunk of data at any given offset. Byterage has been used in a wide variety of scenarios: a flat-file database, a file archiver, a drawing program (for fetching pixel data from files larger than maximum DIB size) and various experiments.
Byterage does not use assembler but is rather object pascal native. It makes full use of loop reduction to gain very high data transfer rates. It also use int64 for data length to avoid problems with large files. Since it’s written in vanilla object pascal (Delphi 7) it should also be compatible with freepascal / Lazarus and modern Delphi compilers (tested on Delphi XE2 without problems).
To make it easy to use byterage with ordinary object pascal streams I have provided a stream adapter class. This will allow you to consume a byterage buffer as a stream, and consequently copy, read and write to or from the buffer via the TStream interface.
Byterage is an auxiliary library (yet standalone) of filerage. Filerage offers the same native object pascal API but targets file IO over a broad spectrum of storage devices: local disk, ftp, zip archive, automatically mapped network drive and more. Filerage comes with adapters for Remobjects Remoting Framework but runs faster visa its own “to the metal” remoting system.