/** * Stores the supplied value and returns the ID that has been assigned to it. In case the data to store is * already present, the ID of this existing data is returned. * * @param data * The data to store, must not be <tt>null</tt>. * @return The ID that has been assigned to the value. * @exception IOException * If an I/O error occurred. */ public int storeData(byte[] data) throws IOException { assert data != null : "data must not be null"; int id = getID(data); if (id == -1) { // Data not stored yet, store it under a new ID. long offset = dataFile.storeData(data); id = idFile.storeOffset(offset); hashFile.storeID(getDataHash(data), id); } return id; }
/** * Stores the supplied value and returns the ID that has been assigned to it. In case the data to store is * already present, the ID of this existing data is returned. * * @param data * The data to store, must not be <tt>null</tt>. * @return The ID that has been assigned to the value. * @exception IOException * If an I/O error occurred. */ public int storeData(byte[] data) throws IOException { assert data != null : "data must not be null"; int id = getID(data); if (id == -1) { // Data not stored yet, store it under a new ID. long offset = dataFile.storeData(data); id = idFile.storeOffset(offset); hashFile.storeID(getDataHash(data), id); } return id; }
int hash = getDataHash(queryData); HashFile.IDIterator iter = hashFile.getIDIterator(hash); try {
int hash = getDataHash(queryData); HashFile.IDIterator iter = hashFile.getIDIterator(hash); try {