public void write(final byte[] data) throws HeapException {
assertOpenned();
if (positionInFile + data.length > size) {
size = (int) (positionInFile + data.length);
if (size > image.length) {
throw new HeapException("out of image buffer");
}
}
for (int index = 0; index < data.length; index++) {
image[(int) positionInFile++] = data[index];
}