public void update(Value key, long p, byte[] value) throws ReadOnlyException { RecordPos rec = findValuePosition(p); short l = ByteConversion.byteToShort(rec.page.data, rec.offset); if (value.length < l) {  System.out.println(value.length + " < " + l); System.out.println(rec.page.page.getPageInfo() + "; offset = " + rec.offset + "; data-len = " + rec.page.getPageHeader().getDataLength() + "; previous-page = " + rec.page.getPageHeader().getPrevDataPage()); throw new RuntimeException("shrinked");                } else if (value.length > l) { throw new IllegalStateException("value too long"); } else {  System.arraycopy( value, 0, rec.page.data, rec.offset + 2, value.length);
public boolean update(Value key, byte[] value) throws ReadOnlyException { try { long p = findValue(key); if (p == KEY_NOT_FOUND) return false;  update(key, p, value); } catch (BTreeException bte) { LOG.debug(bte); bte.printStackTrace(); return false; } catch (IOException ioe) { LOG.debug(ioe); return false;
	public void update(Value key, long p, byte[] value)		throws ReadOnlyException {		RecordPos rec = findValuePosition(p);		short l = ByteConversion.byteToShort(rec.page.data, rec.offset);		if (value.length < l) {			// value is smaller than before			System.out.println(value.length + " < " + l);			System.out.println(rec.page.page.getPageInfo() + "; offset = " +				rec.offset + "; data-len = " + 				rec.page.getPageHeader().getDataLength() +				"; previous-page = " + rec.page.getPageHeader().getPrevDataPage());			throw new RuntimeException("shrinked");//			int next = rec.offset + 2 + l;//			ByteConversion.shortToByte(//				(short) value.length,//				rec.page.data,//				rec.offset);//			rec.offset += 2;//			System.arraycopy(value, 0, rec.page.data, rec.offset, value.length);//			rec.offset += value.length;//			System.arraycopy(//				rec.page.data,//				next,//				rec.page.data,//				rec.offset,//				rec.page.getPageHeader().getDataLength() - next);//			rec.page.len = rec.page.len - (l - value.length);		} else if (value.length > l) {			throw new IllegalStateException("value too long");		} else {			// value length unchanged			System.arraycopy(				value,				0,				rec.page.data,				rec.offset + 2,				value.length);		}		rec.page.setDirty(true);	}