HexFiend: HFByteArray(HFFileWriting) Category Reference

HexFiend

Instance Methods | List of all members
HFByteArray(HFFileWriting) Category Reference

HFByteArray methods for writing to files, and preparing other HFByteArrays for potentially destructive file writes.

## Instance Methods
(BOOL) | - writeToFile:trackingProgress:error:
(NSArray *) | - rangesOfFileModifiedIfSavedToFile:
(BOOL) | - clearDependenciesOnRanges:inFile:hint:

## Method Documentation

## § writeToFile:trackingProgress:error:()

- (BOOL) writeToFile: |  | (NSURL *) | targetURL
trackingProgress: |  | (HFProgressTracker *) | progressTracker
error: |  | (NSError **) | error

Attempts to write the receiver to a file. This is a concrete method on HFByteArray.

Parameters

  targetURL | A URL to the file to be written to. It is OK for the receiver to contain one or more instances of HFByteSlice that are sourced from the file.
  progressTracker | An HFProgressTracker to allow progress reporting and cancelleation for the write operation.
  error | An out NSError parameter.

Returns
  YES if the write succeeded, NO if it failed.

Extends class HFByteArray.

## § rangesOfFileModifiedIfSavedToFile:()

- (NSArray *) rangesOfFileModifiedIfSavedToFile: |  | (HFFileReference *) | reference |

Returns the ranges of the file that would be modified, if the receiver were written to it. This is useful (for example) in determining if the clipboard can be preserved after a save operation. This is a concrete method on HFByteArray.

Parameters

  reference | An HFFileReference to the file to be modified

Returns
  An array of HFRangeWrappers, representing the ranges of the file that would be affected. If no range would be affected, the result is an empty array.

Extends class HFByteArray.

## § clearDependenciesOnRanges:inFile:hint:()

- (BOOL) clearDependenciesOnRanges: |  | (NSArray *) | ranges
inFile: |  | (HFFileReference *) | reference
hint: |  | (NSMutableDictionary *) | hint

Attempts to modify the receiver so that it no longer depends on any of the HFRanges in the array within the given file. It is not necessary to perform this operation on the byte array that is being written to the file.

Parameters

  ranges | An array of HFRangeWrappers, representing ranges in the given file that the receiver should no longer depend on.
  reference | The HFFileReference that the receiver should no longer depend on.
  hint | A dictionary that can be used to improve the efficiency of the operation, by allowing multiple byte arrays to share the same state. If you plan to call this method on multiple byte arrays, pass the first one an empty NSMutableDictionary, and pass the same dictionary to subsequent calls.

Returns
  A YES return indicates the operation was successful, and the receiver no longer contains byte slices that source data from any of the ranges of the given file (or never did). A NO return indicates that breaking the dependencies would require too much memory, and so the receiver still depends on some of those ranges.

Extends class HFByteArray.

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

- HFByteArray.h