summaryrefslogtreecommitdiff
path: root/sources/scalac/util
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2003-08-06 16:41:30 +0000
committerMartin Odersky <odersky@gmail.com>2003-08-06 16:41:30 +0000
commite1d1b2d9b8797b2af95c247f840ccb11b1857dc7 (patch)
tree64b90516b728f57d4fb6263d5711b4704f0009b3 /sources/scalac/util
parent57fdd4109972ddadc83d5dbb23e50993a6359145 (diff)
downloadscala-e1d1b2d9b8797b2af95c247f840ccb11b1857dc7.tar.gz
scala-e1d1b2d9b8797b2af95c247f840ccb11b1857dc7.tar.bz2
scala-e1d1b2d9b8797b2af95c247f840ccb11b1857dc7.zip
*** empty log message ***
Diffstat (limited to 'sources/scalac/util')
-rw-r--r--sources/scalac/util/AbstractFile.java32
-rw-r--r--sources/scalac/util/AbstractFileReader.java5
2 files changed, 37 insertions, 0 deletions
diff --git a/sources/scalac/util/AbstractFile.java b/sources/scalac/util/AbstractFile.java
index 2487e07ca3..7069df868b 100644
--- a/sources/scalac/util/AbstractFile.java
+++ b/sources/scalac/util/AbstractFile.java
@@ -39,6 +39,10 @@ public abstract class AbstractFile {
*/
public abstract boolean isDirectory();
+ /** date file was last modified
+ */
+ public abstract long lastModified();
+
/** read content of the file into a byte[] buffer
*/
public abstract byte[] read() throws IOException;
@@ -129,6 +133,10 @@ class PlainFile extends AbstractFile {
return f.isDirectory();
}
+ public long lastModified() {
+ return f.lastModified();
+ }
+
public byte[] read() throws IOException {
FileInputStream in = new FileInputStream(f);
int rest = (int)f.length();
@@ -196,6 +204,10 @@ class ZippedFile extends AbstractFile {
return zipEntry.isDirectory();
}
+ public long lastModified() {
+ return zipEntry.getTime();
+ }
+
public byte[] read() throws IOException {
InputStream in = dir.zipFile.getInputStream(zipEntry);
int rest = (int)zipEntry.getSize();
@@ -254,6 +266,10 @@ class ZipDir extends AbstractFile {
return (zipFile != null);
}
+ public long lastModified() {
+ return -1;
+ }
+
public byte[] read() throws IOException {
throw new IOException("cannot read directory");
}
@@ -322,6 +338,10 @@ final class JarArchive extends AbstractFile {
return jarFile != null;
}
+ public long lastModified() {
+ return -1;
+ }
+
public byte[] read() throws IOException {
throw new IOException("cannot read archive");
}
@@ -443,6 +463,10 @@ final class JarArchive extends AbstractFile {
return true;
}
+ public long lastModified() {
+ return -1;
+ }
+
public String[] list() throws IOException {
throw new IOException("not a directory");
}
@@ -510,6 +534,10 @@ final class JarArchive extends AbstractFile {
return false;
}
+ public long lastModified() {
+ return -1;
+ }
+
public String[] list() throws IOException {
throw new IOException("not a directory");
}
@@ -537,6 +565,10 @@ final class JarArchive extends AbstractFile {
return true;
}
+ public long lastModified() {
+ return jarFile.getJarEntry(name).getTime();
+ }
+
public byte[] read() throws IOException {
JarEntry jarEntry = jarFile.getJarEntry(name);
if (jarEntry == null)
diff --git a/sources/scalac/util/AbstractFileReader.java b/sources/scalac/util/AbstractFileReader.java
index 0d18292838..2f7d0e1e21 100644
--- a/sources/scalac/util/AbstractFileReader.java
+++ b/sources/scalac/util/AbstractFileReader.java
@@ -21,11 +21,16 @@ public class AbstractFileReader {
*/
public int bp;
+ /** the file path name
+ */
+ public final String path;
+
/** constructor
*/
public AbstractFileReader(AbstractFile f) throws IOException {
buf = f.read();
bp = 0;
+ path = f.getPath();
}
/** return byte at offset 'pos'