final long addr = collectionsDb.put(name, ostream.toByteArray());
final long addr = collectionsDb.put(name, ostream.data());
	public void saveCollection(Collection collection) throws PermissionDeniedException {		if (readOnly)			throw new PermissionDeniedException("database is read-only");		try {			if (collection.getId() < 0)				collection.setId(getNextCollectionId());			Value name;			try {				name = new Value(collection.getName().getBytes("UTF-8"));			} catch (UnsupportedEncodingException uee) {				LOG.debug(uee);				name = new Value(collection.getName().getBytes());			}			try {				final VariableByteOutputStream ostream = new VariableByteOutputStream();				collection.write(ostream);				Lock lock = collectionsDb.getLock();				try {					lock.acquire(Lock.WRITE_LOCK);					final long addr = collectionsDb.put(name, ostream.toByteArray());					if (addr < 0) {						LOG.debug("could not store collection data for " + collection.getName());						return;					}					collection.setAddress(addr);					if (!name.equals("/db")) {						Collection parent = collection.getParent();						parent.update(collection);						saveCollection(parent);					}				} catch (LockException e) {					LOG.warn("could not acquire lock for collections store", e);				} finally {					lock.release();				}			} catch (IOException ioe) {				LOG.debug(ioe);			}		} catch (ReadOnlyException e) {			LOG.warn("database is read-only");		}		collections.add(collection);	}