The KcsChunkSet class provides an interface to access chunks (or blocks) of data in a static store (such as a file on disk).
Chunks are separated blocks of data that contain any type of data. The KcsChunkSet class does not know what the data is in the blocks. It provides functions to manipulate the blocks, such as arranging and resizing them.
A chunk set has two components: a chunk map and the chunks. As shown in Figure 1-3 , the chunk map is a table containing an array of descriptions of each chunk. Each chunk map entry contains the chunk Id (a unique identifier for that block), the offset, and the chunk size.
The ICC profile format is directly analogous to the KcsChunkSet.
Some KcsChunkSet class features are:
It identifies each chunk by a unique chunkId.
All objects based on KcsChunkSets can be uniquely identified with a combination of KcsChunkSet and chunkId.
It uses a ChunkMap object to keep track of each chunk's size and the offset of the chunk within the static store.
It knows nothing about the contents of a chunk.
It uses an I/O object and tells its I/O object the offset and number of bytes to read or write. Then the I/O object does the actual reading or writing.
If the size of one chunk changes, it adjusts the location of other chunks in static store as necessary to accommodate the change.
It relieves other classes from keeping track of specific offsets within the static store.
It regenerates loadable objects from the static store.
The KcsChunkSet method can be used for various reasons. For example, you need the chunk Id(s) to access data directly. Use KcsChunkSet to read or write a particular chunk Id. You do not need the specific offsets within the static store, but you do need to know the chunk Id(s). You can also specify to write a chunk at a specific static store location. You may want to do this for format conventions that require specific data be stored at a specific location within the static store. In this case, KcsChunkSet moves other chunks to accommodate this request.