summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/util/VirtualFile.scala
diff options
context:
space:
mode:
authormihaylov <mihaylov@epfl.ch>2006-04-11 15:36:05 +0000
committermihaylov <mihaylov@epfl.ch>2006-04-11 15:36:05 +0000
commit8b6c8a3c0709bc13c74f11ffb660c1c764564915 (patch)
treece7d0966fa603eb983e99056688fad83d22c3ee0 /src/compiler/scala/tools/util/VirtualFile.scala
parent0f46fe4ca5ac451a05f5d5ddb7e6cdca646c4979 (diff)
downloadscala-8b6c8a3c0709bc13c74f11ffb660c1c764564915.tar.gz
scala-8b6c8a3c0709bc13c74f11ffb660c1c764564915.tar.bz2
scala-8b6c8a3c0709bc13c74f11ffb660c1c764564915.zip
Rewrote the files in scala/tools/util/ in Scala
Diffstat (limited to 'src/compiler/scala/tools/util/VirtualFile.scala')
-rw-r--r--src/compiler/scala/tools/util/VirtualFile.scala67
1 files changed, 67 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/util/VirtualFile.scala b/src/compiler/scala/tools/util/VirtualFile.scala
new file mode 100644
index 0000000000..58360b2a34
--- /dev/null
+++ b/src/compiler/scala/tools/util/VirtualFile.scala
@@ -0,0 +1,67 @@
+/* ____ ____ ____ ____ ______ *\
+** / __// __ \/ __// __ \/ ____/ SOcos COmpiles Scala **
+** __\_ \/ /_/ / /__/ /_/ /\_ \ (c) 2002-2006, LAMP/EPFL **
+** /_____/\____/\___/\____/____/ **
+\* */
+
+// $Id$
+
+
+package scala.tools.util;
+
+
+import java.io.{File,IOException};
+
+/** This class implements an empty abstract regular file. */
+class VirtualFile(val name: String, _path: String) extends AbstractFile {
+
+ assert(name != null && path != null, name + " - " + path);
+
+ //########################################################################
+ // Public Constructors
+
+ /**
+ * Initializes this instance with the specified name and an
+ * identical path.
+ */
+ def this(name: String) = this(name, name);
+
+ //########################################################################
+ // Public Methods
+
+ def path = _path;
+
+ /** Returns null. */
+ final def file: File = null;
+
+ /** Is this abstract file a directory? */
+ def isDirectory: Boolean = false;
+
+ /** Returns the time that this abstract file was last modified. */
+ def lastModified: Long = Long.MIN_VALUE;
+
+ /** Reads the content of this abstract file into a byte array. */
+ def read: Array[Byte] = {
+ assert(!isDirectory, "cannot read directory '" + this + "'");
+ new Array[Byte](0);
+ }
+
+ /** Returns all abstract subfiles of this abstract directory. */
+ def elements: Iterator[AbstractFile] = {
+ assert(isDirectory, "not a directory '" + this + "'");
+ Iterator.empty;
+ }
+
+ /**
+ * Returns the abstract file in this abstract directory with the
+ * specified name. If there is no such file, returns null. The
+ * argument "directory" tells whether to look for a directory or
+ * or a regular file.
+ */
+ def lookupName(name: String, directory: Boolean): AbstractFile = {
+ assert(isDirectory, "not a directory '" + this + "'");
+ null;
+ }
+
+ //########################################################################
+}