diff options
author | Burak Emir <emir@epfl.ch> | 2006-10-18 14:21:13 +0000 |
---|---|---|
committer | Burak Emir <emir@epfl.ch> | 2006-10-18 14:21:13 +0000 |
commit | 00db012c72614355680834516ccd649cf48d63ac (patch) | |
tree | 2b112177824fd4e1a67218eef744285a1317692b /src/compiler/scala/tools/nsc/io/PlainFile.scala | |
parent | 3475351c461b833ebd5841b9af829b975e0c3657 (diff) | |
download | scala-00db012c72614355680834516ccd649cf48d63ac.tar.gz scala-00db012c72614355680834516ccd649cf48d63ac.tar.bz2 scala-00db012c72614355680834516ccd649cf48d63ac.zip |
abstractfile api + small cleanup
Diffstat (limited to 'src/compiler/scala/tools/nsc/io/PlainFile.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/io/PlainFile.scala | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/src/compiler/scala/tools/nsc/io/PlainFile.scala b/src/compiler/scala/tools/nsc/io/PlainFile.scala index 8d24387b4f..1cf3241b80 100644 --- a/src/compiler/scala/tools/nsc/io/PlainFile.scala +++ b/src/compiler/scala/tools/nsc/io/PlainFile.scala @@ -41,6 +41,8 @@ class PlainFile(val file: File) extends AbstractFile { override def read = new FileInputStream(file) + override def size = Some(file.length.toInt) + override def hashCode(): Int = try { file.getCanonicalPath().hashCode() } catch { case _: IOException => 0 } @@ -61,23 +63,6 @@ class PlainFile(val file: File) extends AbstractFile { /** Returns the time that this abstract file was last modified. */ def lastModified: Long = file.lastModified() - /** Reads the content of this abstract file into a byte array. - override def getBytes: Array[Byte] = { - assert(!isDirectory, "cannot read directory '" + this + "'"); - val in = new FileInputStream(file) - var rest: Int = file.length().toInt - val buf: Array[Byte] = new Array[Byte](rest) - while (rest > 0) { - val res = in.read(buf, buf.length - rest, rest); - if (res == -1) - throw new IOException("read error"); - rest = rest - res - } - in.close() - buf - } - */ - /** Returns all abstract subfiles of this abstract directory. */ def elements: Iterator[AbstractFile] = { assert(isDirectory, "not a directory '" + this + "'") |