Revision 47665 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.lib/src/main/java/org/gvsig/fmap/dal/store/simplereader/SimpleReaderUtils.java
SimpleReaderUtils.java | ||
---|---|---|
11 | 11 |
import java.io.InputStream; |
12 | 12 |
import java.io.InputStreamReader; |
13 | 13 |
import java.nio.charset.Charset; |
14 |
import java.util.Objects; |
|
15 |
import org.apache.commons.io.FileUtils; |
|
14 | 16 |
import org.apache.commons.io.input.BOMInputStream; |
15 | 17 |
import org.apache.commons.lang3.StringUtils; |
16 | 18 |
import org.slf4j.Logger; |
... | ... | |
43 | 45 |
return isr; |
44 | 46 |
} |
45 | 47 |
|
48 |
public static boolean isFileNewer(File file, File fileReference){ |
|
49 |
if(file == null || fileReference == null){ |
|
50 |
return false; |
|
51 |
} |
|
52 |
long lastModified = fileReference.lastModified(); |
|
53 |
// Por si el archivo nos lo ha enviado el Doctor Who desde el futuro |
|
54 |
long now = System.currentTimeMillis(); |
|
55 |
if(now < lastModified){ |
|
56 |
LOGGER.warn("The file date is future " + Objects.toString(fileReference)); |
|
57 |
lastModified = now; |
|
58 |
} |
|
59 |
return FileUtils.isFileNewer(file, lastModified); |
|
60 |
} |
|
46 | 61 |
|
62 |
public static boolean isFileNewer(File file, long reference){ |
|
63 |
if(file == null){ |
|
64 |
return false; |
|
65 |
} |
|
66 |
// Por si el archivo nos lo ha enviado el Doctor Who desde el futuro |
|
67 |
long now = System.currentTimeMillis(); |
|
68 |
if(now < reference){ |
|
69 |
LOGGER.warn("The reference file date is future " + Objects.toString(file)); |
|
70 |
reference = now; |
|
71 |
} |
|
72 |
return FileUtils.isFileNewer(file, reference); |
|
73 |
} |
|
47 | 74 |
} |
Also available in: Unified diff