Hex Fiend relies on a fast, memory efficient representation of the data each document displays.
A ByteSlice is often contained by one or more ByteArrayPieces. While a ByteSlice is merely a sequence of bytes, a ByteArrayPiece knows the offset of that sequence within the document. Multiple ByteArrayPieces can share a single ByteSlice. ByteArrayPiece is concrete and has no subclasses.
The most important class is ByteArray, which is the model in the MVC design. ByteArray is conceptually a mutable array of ByteArrayPieces, but also a mutable sequence of bytes. ByteArray is abstract, with concrete subclasses FullMemoryByteArray and TavlTreeByteArray. Each MyDocument contains a single ByteArray, which represents the data for the document.