p = update(p, page, key, new FixedByteArray(newData));
p = update(p, page, key, new FixedByteArray(newData, 0, newData.length));
    public long append(Value key, ByteArray value) throws ReadOnlyException,            IOException {        if (key == null) {            LOG.debug("key is null");            return -1;        }        try {            try {                // check if key exists already                long p = findValue(key);                if (p == KEY_NOT_FOUND) {                    // key does not exist:                    p = storeValue(value);                    addValue(key, p);                    return p;                }                // key exists: get old data                final long pnum = StorageAddress.pageFromPointer(p);                final short tid = StorageAddress.tidFromPointer(p);                final DataPage page = getDataPage(pnum);                if (page instanceof OverflowPage)                    ((OverflowPage) page).append(value);                else {                    final int valueLen = value.size();                    final byte[] data = page.getData();                    final int offset = page.findValuePosition(tid);                    if (offset < 0)                            throw new IOException("tid " + tid                                    + " not found on page " + pnum);                    final int l = ByteConversion.byteToInt(data, offset);                    if (offset + 4 > data.length || offset < 0) {                        LOG.error("wrong pointer (tid: " + tid                                + page.getPageInfo() + ") in file "                                + getFile().getName() + "; offset = " + offset);                        return -1;                    }                    if (offset + 4 + l > data.length) {                        LOG.error("found invalid data record ("                                + page.getPageInfo() + "): " + "length="                                + data.length + "; required="                                + (offset + 4 + l));                        return -1;                    }                    final byte[] newData = new byte[l + valueLen];                    System.arraycopy(data, offset + 4, newData, 0, l);                    value.copyTo(newData, l);                    p = update(p, page, key, new FixedByteArray(newData));                }                return p;            } catch (BTreeException bte) {                // key does not exist:                long p = storeValue(value);                addValue(key, p);                return p;            }        } catch (BTreeException bte) {            LOG.warn("btree exception while appending value", bte);        }        return -1;    }