virtualfile.scala

来自「JAVA 语言的函数式编程扩展」· SCALA 代码 · 共 80 行

SCALA
80
字号
/* NSC -- new Scala compiler * Copyright 2005-2007 LAMP/EPFL * @author  Martin Odersky */// $Id: VirtualFile.scala 12886 2007-09-17 16:36:10Z mcdirmid $package scala.tools.nsc.ioimport java.io.{File, InputStream}/** This class implements an empty abstract regular file. * *  @author  Philippe Altherr *  @version 1.0, 23/03/2004 */class VirtualFile(val name: String, _path: String) extends AbstractFile {  assert((name ne null) && (path ne null), name + " - " + path)  //########################################################################  // Public Constructors  /**   * Initializes this instance with the specified name and an   * identical path.   *   * @param name the name of the virtual file to be created   * @return     the created virtual file   */  def this(name: String) = this(name, name)    override def hashCode = name.hashCode  override def equals(that : Any) = that match {  case that : VirtualFile => name == that.name  case _ => false  }  //########################################################################  // Public Methods  def path = _path  /** Returns null. */  final def file: File = null  def input : InputStream = throw new Error("not supported");    def container : AbstractFile = throw new Error("not supported")  /** Is this abstract file a directory? */  def isDirectory: Boolean = false  /** Returns the time that this abstract file was last modified. */  def lastModified: Long = Math.MIN_LONG  /** 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.   *   * @param name      ...   * @param directory ...   * @return          ...   */  def lookupName(name: String, directory: Boolean): AbstractFile = {    assert(isDirectory, "not a directory '" + this + "'")    null  }  //########################################################################}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?