Package java.io

Examples of java.io.File.compareTo()


    String base = System.getProperty("user.dir");
    if (!base.endsWith(slash))
      base += slash;
    File f = new File(base, "temp.tst");
    File f2 = f.getAbsoluteFile();
    assertEquals("Test 1: Incorrect File Returned.", 0, f2.compareTo(f
        .getAbsoluteFile()));
    f = new File(base + "Temp" + slash + slash + "temp.tst");
    f2 = f.getAbsoluteFile();
    assertEquals("Test 2: Incorrect File Returned.", 0, f2.compareTo(f
        .getAbsoluteFile()));
View Full Code Here


    File f2 = f.getAbsoluteFile();
    assertEquals("Test 1: Incorrect File Returned.", 0, f2.compareTo(f
        .getAbsoluteFile()));
    f = new File(base + "Temp" + slash + slash + "temp.tst");
    f2 = f.getAbsoluteFile();
    assertEquals("Test 2: Incorrect File Returned.", 0, f2.compareTo(f
        .getAbsoluteFile()));
    f = new File(base + slash + ".." + slash + "temp.tst");
    f2 = f.getAbsoluteFile();
    assertEquals("Test 3: Incorrect File Returned.", 0, f2.compareTo(f
        .getAbsoluteFile()));
View Full Code Here

    f2 = f.getAbsoluteFile();
    assertEquals("Test 2: Incorrect File Returned.", 0, f2.compareTo(f
        .getAbsoluteFile()));
    f = new File(base + slash + ".." + slash + "temp.tst");
    f2 = f.getAbsoluteFile();
    assertEquals("Test 3: Incorrect File Returned.", 0, f2.compareTo(f
        .getAbsoluteFile()));
    f.delete();
    f2.delete();
  }
View Full Code Here

                     * If the "short file name" doesn't exist, then assume that
                     * the 8.3 file name compatibility is disabled.
                     */
                    if (canonicalf2.exists()) {
          assertTrue("Test 5: Incorrect File Returned: "
              + canonicalf2, canonicalf2.compareTo(f
              .getCanonicalFile()) == 0);
                    }
        } finally {
          f.delete();
          f2.delete();
View Full Code Here

        assertEquals(f1ParentName, f1.getPath());
       
        String f2ParentName = "0";
        File f2 = new File(f2ParentName, "");

        assertEquals(-1, f2.compareTo(f1));
        assertEquals(1, f1.compareTo(f2));

        File parent = new File(System.getProperty("user.dir"));
        File f3 = new File(parent, "");
View Full Code Here

       * Block exists in volumeMap and the block file exists on the disk
       */
      // Compare block files
      File memFile = memBlockInfo.getBlockFile();
      if (memFile.exists()) {
        if (memFile.compareTo(diskFile) != 0) {
          LOG.warn("Block file " + memFile.getAbsolutePath()
              + " does not match file found by scan "
              + diskFile.getAbsolutePath());
          // TODO: Should the diskFile be deleted?
        }
View Full Code Here

      // Compare generation stamp
      if (memBlockInfo.getGenerationStamp() != diskGS) {
        File memMetaFile = FsDatasetUtil.getMetaFile(diskFile,
            memBlockInfo.getGenerationStamp());
        if (memMetaFile.exists()) {
          if (memMetaFile.compareTo(diskMetaFile) != 0) {
            LOG.warn("Metadata file in memory "
                + memMetaFile.getAbsolutePath()
                + " does not match file found by scan "
                + (diskMetaFile == null? null: diskMetaFile.getAbsolutePath()));
          }
View Full Code Here

        File[] files = rootDirectory.listFiles(filter);
        Arrays.sort(files, new Comparator() {
            public int compare(Object o1, Object o2) {
                File f1 = (File) o1;
                File f2 = (File) o2;
                return f2.compareTo(f1);
            }
        });
        for (int i = 0; i < files.length; i++) {
            File file = files[i];
            String name = file.getName();
View Full Code Here

       * Block exists in volumeMap and the block file exists on the disk
       */
      // Compare block files
      File memFile = memBlockInfo.getBlockFile();
      if (memFile.exists()) {
        if (memFile.compareTo(diskFile) != 0) {
          LOG.warn("Block file " + memFile.getAbsolutePath()
              + " does not match file found by scan "
              + diskFile.getAbsolutePath());
          // TODO: Should the diskFile be deleted?
        }
View Full Code Here

      // Compare generation stamp
      if (memBlockInfo.getGenerationStamp() != diskGS) {
        File memMetaFile = FsDatasetUtil.getMetaFile(diskFile,
            memBlockInfo.getGenerationStamp());
        if (memMetaFile.exists()) {
          if (memMetaFile.compareTo(diskMetaFile) != 0) {
            LOG.warn("Metadata file in memory "
                + memMetaFile.getAbsolutePath()
                + " does not match file found by scan "
                + (diskMetaFile == null? null: diskMetaFile.getAbsolutePath()));
          }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.