Patent ID: 8131785

Claim:
A method performed by data processing apparatus, the method comprising: obtaining new data of a given size to be added to an electronic document conforming to a format comprising a hierarchical structure, where the electronic document includes stored data and free spaces at different nodes within the hierarchical structure; determining whether a first node in the hierarchical structure includes a first free space of a size sufficient to accommodate the new data of the given size; using the first free space in the first node to add the new data to the electronic document in a storage device when the size of the first free space is sufficient; and when the size of the first free space is insufficient: identifying a second node in the hierarchical structure that includes a second free space, moving at least some of the second free space to the first free space, thereby increasing the size of the first free space, and using the increased first free space in the first node to add the new data to the electronic document in a storage device.