1 21 22 package org.opensubsystems.core.util; 23 24 import java.io.File ; 25 import java.util.Comparator ; 26 27 36 public class FileLengthComparator implements Comparator 37 { 38 40 44 private static Comparator s_instance = new FileLengthComparator(); 45 46 48 53 public static Comparator getInstance( 54 ) 55 { 56 return s_instance; 57 } 58 59 68 public int compare( 69 Object o1, 70 Object o2 71 ) 72 { 73 long lLength1 = ((File )o1).length(); 74 long lLength2 = ((File )o2).length(); 75 76 if (lLength1 < lLength2) 77 { 78 return -1; 79 } 80 else 81 { 82 if (lLength1 == lLength2) 83 { 84 return 0; 85 } 86 else 87 { 88 return 1; 89 } 90 } 91 } 92 } 93 | Popular Tags |