HFByteSlice Class Reference
[Model]

A class representing a source of data for an HFByteArray. More...

Inheritance diagram for HFByteSlice:

HFFileByteSlice HFFullMemoryByteSlice HFProcessMemoryByteSlice HFSharedMemoryByteSlice

List of all members.

Public Member Functions

(unsigned long long) - length
(void) - copyBytes:range:
(HFByteSlice *) - subsliceWithRange:
(id) - byteSliceByAppendingSlice:
(BOOL) - isSourcedFromFile
(HFRange- sourceRangeForFile:


Detailed Description

HFByteSlice is an abstract class encapsulating primitive data sources (files, memory buffers, etc.). Each source must support random access reads, and have a well defined length. All HFByteSlices are immutable.

The two principal subclasses of HFByteSlice are HFSharedMemoryByteSlice and HFFileByteSlice, which respectively encapsulate data from memory and from a file.


Member Function Documentation

- (unsigned long long) length  

Return the length of the byte slice as a 64 bit value. This is an abstract method that concrete subclasses must override.

- (void) copyBytes: (unsigned char *)  dst
range: (HFRange range 

Copies a range of data from the byte slice into an in-memory buffer. This is an abstract method that concrete subclasses must override.

- (HFByteSlice *) subsliceWithRange: (HFRange range  

Returns a new slice containing a subrange of the given slice. This is an abstract method that concrete subclasses must override.

- (id) byteSliceByAppendingSlice: (HFByteSlice *)  slice  

Attempts to create a new byte slice by appending one byte slice to another. This does not modify the receiver or the slice argument (after all, both are immutable). This is provided as an optimization, and is allowed to return nil if the appending cannot be done efficiently. The default implementation returns nil.

- (BOOL) isSourcedFromFile  

Returns YES if the receiver is sourced from a file. The default implementation returns NO. This is used to estimate cost when writing to a file.

- (HFRange) sourceRangeForFile: (HFFileReference *)  reference  

For a given file reference, returns the range within the file that the receiver is sourced from. If the receiver is not sourced from this file, returns {ULLONG_MAX, ULLONG_MAX}. The default implementation returns {ULLONG_MAX, ULLONG_MAX}. This is used during file saving to to determine how to properly overwrite a given file.


The documentation for this class was generated from the following file:

Generated on Thu Dec 8 10:06:35 2011 for HexFiend by  doxygen 1.5.9