Beispiel #1
0
  @Test
  public void filestat() throws Throwable {
    File f = File.createTempFile("stat", null);
    int size = 1567;
    // Thread.sleep(2000);
    addNBytes(f, size);
    try {
      FileStat stat = posix.stat(f.getAbsolutePath());
      assertNotNull("posix.stat failed", stat);
      assertEquals(size, stat.st_size());
      // assertNotEquals(stat.mtime(), stat.ctime());

      stat = posix.allocateStat();
      int result = posix.stat(f.getAbsolutePath(), stat);
      assertNotNull("posix.stat failed", stat);
      assertEquals(0, result);
      assertEquals(size, stat.st_size());
    } finally {
      f.delete();
    }
  }
Beispiel #2
0
  @Test
  public void filestatDescriptor() throws Throwable {
    File f = File.createTempFile("stat", null);

    try {
      FileInputStream fis = new FileInputStream(f);
      FileStat stat = posix.allocateStat();
      int result = posix.fstat(fis.getFD(), stat);
      assertEquals(0, result);
      assertEquals(0, stat.st_size());
    } finally {
      f.delete();
    }
  }