public void writeBlock(int id, int[] values) {
    cacheMetaData.put(id, values.length);
    
    Int2ObjectMap<int[]> storage = getOrLoadStorage();
    storage.put(id, values);
    
    OutputStream out = null;
    try {
      out = new BufferedOutputStream(new FileOutputStream(file));
      
      for (Entry metaEntry : cacheMetaData.int2IntEntrySet()) {
        int[] storedValues = storage.get(metaEntry.getIntKey());
        for (int i = 0; i < storedValues.length; i++) {
          EncodingUtils.writeInt(storedValues[i], out);
        }
      }
    } catch (IOException e) {
      throw new RuntimeException(e);
    } finally {
      try {
        if (out != null)
          out.close();
      } catch (IOException e) {
        e.printStackTrace();
      }

    }
  }