FmqFile { public FmqFile (final String parent, final String name) { this (new File (parent, name)); } FmqFile(final String parent, final String name);  FmqFile(final File parent, final String name);  FmqFile(File path); void destroy(); FmqFile dup(); String name(String prefix); void restat(); boolean exists(); boolean stable(); void remove(); boolean input(); boolean output(); FmqChunk read(int bytes, long offset); boolean write(FmqChunk chunk, long offset); boolean write(String data, long offset); void close(); FileChannel handle(); String hash(); long time(); long size();  }
@Test public void testFmqFile () throws Exception { System.out.printf (" * fmq_file: "); FmqFile file = new FmqFile (".", "bilbo"); assertEquals (file.name ("."), "bilbo"); assertEquals (file.exists (), false); file.destroy (); file = new FmqFile ("./this/is/a/test", "bilbo"); boolean rc = file.output (); assertEquals (rc, true); FmqChunk chunk = new FmqChunk (null, 100); chunk.fill ((byte) 0, 100); rc = file.write (chunk, 1000000); assertEquals (rc, true); file.close (); assertEquals (file.exists (), true); assertEquals (file.size (), 1000100); assertEquals (file.stable (), false); chunk.destroy (); Thread.sleep (1001); file.restat (); assertEquals (file.stable (), true); rc = file.input (); assertEquals (rc, true); chunk = file.read (1000100, 0); assertNotNull (chunk); assertEquals (chunk.size (), 1000100); chunk.destroy (); FmqFile link = new FmqFile ("./this/is/a/test", "bilbo.ln"); rc = link.output (); assertEquals (rc, true); link.handle ().write (ByteBuffer.wrap ("./this/is/a/test/bilbo\n".getBytes ())); link.destroy (); link = new FmqFile ("./this/is/a/test", "bilbo.ln"); rc = link.input (); assertEquals (rc, true); chunk = file.read (1000100, 0); assertNotNull (chunk); assertEquals (chunk.size (), 1000100); chunk.destroy (); link.destroy (); FmqDir dir = FmqDir.newFmqDir ("./this", null); assertEquals (dir.size (), 2000200); dir.remove (true); assertEquals (dir.size (), 0); dir.destroy (); assertEquals (file.exists (), true); file.restat (); assertEquals (file.exists (), false); rc = file.input (); assertEquals (rc, false); file.destroy (); System.out.printf ("OK\n"); }