IndexMeta implements Comparable<IndexMeta> { public void writeTo(File file) throws IOException { Properties p = new Properties(); p.putAll(properties); p.setProperty("metaFormatVersion", String.valueOf(metaFormatVersion)); p.setProperty("indexPath", indexPath); p.setProperty("creationTime", String.valueOf(creationTime)); OutputStream os = null; try { os = new BufferedOutputStream(new FileOutputStream(file)); p.store(os, "Index metadata"); } finally { org.apache.commons.io.IOUtils.closeQuietly(os); } } IndexMeta(String indexPath);  IndexMeta(String indexPath, long creationTime);  IndexMeta(String indexPath, long creationTime, Map<String, String> properties);  IndexMeta(File file); void addDirectoryMapping(String jcrDirName, String fsDirName); @Nullable String getJcrNameFromFSName(String fsDirName); @Nullable String getFSNameFromJCRName(String jcrDirName); void writeTo(File file); @Override int compareTo(IndexMeta o); @Override String toString(); static final String DIR_PREFIX; }
@Test public void writeTo() throws Exception { IndexMeta m = new IndexMeta("/a/b", 100); File f = temporaryFolder.newFile(); m.writeTo(f); IndexMeta m2 = new IndexMeta(f); assertEquals(m.indexPath, m2.indexPath); assertEquals(m.creationTime, m2.creationTime); }