diff options
author | Martin Odersky <odersky@gmail.com> | 2003-08-06 16:41:30 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2003-08-06 16:41:30 +0000 |
commit | e1d1b2d9b8797b2af95c247f840ccb11b1857dc7 (patch) | |
tree | 64b90516b728f57d4fb6263d5711b4704f0009b3 /sources/scalac/util/AbstractFile.java | |
parent | 57fdd4109972ddadc83d5dbb23e50993a6359145 (diff) | |
download | scala-e1d1b2d9b8797b2af95c247f840ccb11b1857dc7.tar.gz scala-e1d1b2d9b8797b2af95c247f840ccb11b1857dc7.tar.bz2 scala-e1d1b2d9b8797b2af95c247f840ccb11b1857dc7.zip |
*** empty log message ***
Diffstat (limited to 'sources/scalac/util/AbstractFile.java')
-rw-r--r-- | sources/scalac/util/AbstractFile.java | 32 |
1 files changed, 32 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) |