AbstractFile

abstract class AbstractFile extends Iterable[AbstractFile]

This class and its children serve to unify handling of files and directories. These files and directories may or may not have some real counter part within the file system. For example, some file handles reference files within a zip archive or virtual ones that exist only in memory.

Every abstract file has a path (i.e. a full name) and a name (i.e. a short name) and may be backed by some real File. There are two different kinds of abstract files: regular files and directories. Regular files may be read and have a last modification time. Directories may list their content and look for subfiles with a specified name or path and of a specified kind.

The interface does not allow to access the content. The class symtab.classfile.AbstractFileReader accesses bytes, knowing that the character set of classfiles is UTF-8. For all other cases, the class SourceFile is used, which honors global.settings.encoding.value.

''Note: This library is considered experimental and should not be used unless you know what you are doing.''

Companion:
object

Value members

Abstract methods

The absolute file, if this is a relative file.

The absolute file, if this is a relative file.

Returns the containing directory of this abstract file

Returns the containing directory of this abstract file

def create(): Unit

Create a file on disk, if one does not exist already.

Create a file on disk, if one does not exist already.

def delete(): Unit

Delete the underlying file or directory (recursively).

Delete the underlying file or directory (recursively).

returns an input stream so the file can be read

returns an input stream so the file can be read

Is this abstract file a directory?

Is this abstract file a directory?

Returns all abstract subfiles of this abstract directory.

Returns all abstract subfiles of this abstract directory.

Returns the underlying Path if any and null otherwise.

Returns the underlying Path if any and null otherwise.

Returns the time that this abstract file was last modified.

Returns the time that this abstract file was last modified.

def lookupName(name: String, directory: Boolean): AbstractFile

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 a regular file.

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 a regular file.

Returns an abstract file with the given name. It does not check that it exists.

Returns an abstract file with the given name. It does not check that it exists.

Returns the name of this abstract file.

Returns the name of this abstract file.

Returns an output stream for writing the file

Returns an output stream for writing the file

Returns the path of this abstract file.

Returns the path of this abstract file.

Concrete methods

Returns the absolute path of this abstract file.

Returns the absolute path of this abstract file.

Returns a buffered output stream for writing the file - defaults to out

Returns a buffered output stream for writing the file - defaults to out

Returns the path of this abstract file in a canonical form.

Returns the path of this abstract file in a canonical form.

Does this abstract file denote an existing file?

Does this abstract file denote an existing file?

def file: JFile

Returns the underlying File if any and null otherwise.

Returns the underlying File if any and null otherwise.

Get the file in this directory with the given name, creating an empty file if it does not already existing.

Get the file in this directory with the given name, creating an empty file if it does not already existing.

Checks extension case insensitively.

Checks extension case insensitively.

Does this abstract file represent something which can contain classfiles?

Does this abstract file represent something which can contain classfiles?

Does this abstract file correspond to something on-disk?

Does this abstract file correspond to something on-disk?

final def lookupPath(parts: Seq[String], directory: Boolean): AbstractFile

Drill down through subdirs looking for the target, as in lookupName. Ths target name is the last of parts.

Drill down through subdirs looking for the target, as in lookupName. Ths target name is the last of parts.

Return an abstract file that does not check that path denotes an existing file.

Return an abstract file that does not check that path denotes an existing file.

size of this file if it is a concrete file.

size of this file if it is a concrete file.

Get the subdirectory with a given name, creating it if it does not already exist.

Get the subdirectory with a given name, creating it if it does not already exist.

@throws(scala.Predef.classOf[java.io.IOException])

Returns contents of file (if applicable) in a byte array.

Returns contents of file (if applicable) in a byte array.

@throws(scala.Predef.classOf[java.io.IOException])

Returns contents of file (if applicable) in a Char array. warning: use Global.getSourceFile() to use the proper encoding when converting to the char array.

Returns contents of file (if applicable) in a Char array. warning: use Global.getSourceFile() to use the proper encoding when converting to the char array.

override def toString(): String

Returns the path of this abstract file.

Returns the path of this abstract file.

Definition Classes
Iterable -> Any
def toURL: URL

An underlying source, if known. Mostly, a zip/jar file.

An underlying source, if known. Mostly, a zip/jar file.

Inherited methods

final def ++[B >: AbstractFile](suffix: IterableOnce[B]): Iterable[B]
Inherited from:
IterableOps
Inherited from:
IterableOnceOps
Inherited from:
IterableOps
def concat[B >: AbstractFile](suffix: IterableOnce[B]): Iterable[B]
Inherited from:
IterableOps
def copyToArray[B >: AbstractFile](xs: Array[B], start: Int, len: Int): Int
Inherited from:
IterableOnceOps
@deprecatedOverriding(message = "This should always forward to the 3-arg version of this method", since = "2.13.4")
def copyToArray[B >: AbstractFile](xs: Array[B], start: Int): Int
Inherited from:
IterableOnceOps
@deprecatedOverriding(message = "This should always forward to the 3-arg version of this method", since = "2.13.4")
Inherited from:
IterableOnceOps
Inherited from:
IterableOnceOps
Inherited from:
IterableOnceOps
Inherited from:
IterableOps
Inherited from:
IterableOps
def flatten[B](implicit asIterable: AbstractFile => IterableOnce[B]): Iterable[B]
Inherited from:
IterableOps
def fold[A1 >: AbstractFile](z: A1)(op: (A1, A1) => A1): A1
Inherited from:
IterableOnceOps
def foldLeft[B](z: B)(op: (B, AbstractFile) => B): B
Inherited from:
IterableOnceOps
def foldRight[B](z: B)(op: (AbstractFile, B) => B): B
Inherited from:
IterableOnceOps
def foreach[U](f: AbstractFile => U): Unit
Inherited from:
IterableOnceOps
Inherited from:
IterableOps
def groupMap[K, B](key: AbstractFile => K)(f: AbstractFile => B): Map[K, Iterable[B]]
Inherited from:
IterableOps
def groupMapReduce[K, B](key: AbstractFile => K)(f: AbstractFile => B)(reduce: (B, B) => B): Map[K, B]
Inherited from:
IterableOps
Inherited from:
IterableOps
Inherited from:
IterableOps
Inherited from:
IterableOnceOps
Definition Classes
Inherited from:
IterableOps
Inherited from:
IterableOnce
Inherited from:
IterableOps
Inherited from:
Iterable
def map[B](f: AbstractFile => B): Iterable[B]
Inherited from:
IterableOps
def max[B >: AbstractFile](implicit ord: Ordering[B]): AbstractFile
Inherited from:
IterableOnceOps
def maxBy[B](f: AbstractFile => B)(implicit cmp: Ordering[B]): AbstractFile
Inherited from:
IterableOnceOps
def maxByOption[B](f: AbstractFile => B)(implicit cmp: Ordering[B]): Option[AbstractFile]
Inherited from:
IterableOnceOps
def maxOption[B >: AbstractFile](implicit ord: Ordering[B]): Option[AbstractFile]
Inherited from:
IterableOnceOps
def min[B >: AbstractFile](implicit ord: Ordering[B]): AbstractFile
Inherited from:
IterableOnceOps
def minBy[B](f: AbstractFile => B)(implicit cmp: Ordering[B]): AbstractFile
Inherited from:
IterableOnceOps
def minByOption[B](f: AbstractFile => B)(implicit cmp: Ordering[B]): Option[AbstractFile]
Inherited from:
IterableOnceOps
def minOption[B >: AbstractFile](implicit ord: Ordering[B]): Option[AbstractFile]
Inherited from:
IterableOnceOps
final def mkString: String
Inherited from:
IterableOnceOps
final def mkString(sep: String): String
Inherited from:
IterableOnceOps
final def mkString(start: String, sep: String, end: String): String
Inherited from:
IterableOnceOps
@deprecatedOverriding(message = "nonEmpty is defined as !isEmpty; override isEmpty instead", since = "2.13.0")
Inherited from:
IterableOnceOps
def partitionMap[A1, A2](f: AbstractFile => Either[A1, A2]): (Iterable[A1], Iterable[A2])
Inherited from:
IterableOps
def product[B >: AbstractFile](implicit num: Numeric[B]): B
Inherited from:
IterableOnceOps
def reduce[B >: AbstractFile](op: (B, B) => B): B
Inherited from:
IterableOnceOps
def reduceLeft[B >: AbstractFile](op: (B, AbstractFile) => B): B
Inherited from:
IterableOnceOps
Inherited from:
IterableOnceOps
def reduceOption[B >: AbstractFile](op: (B, B) => B): Option[B]
Inherited from:
IterableOnceOps
def reduceRight[B >: AbstractFile](op: (AbstractFile, B) => B): B
Inherited from:
IterableOnceOps
Inherited from:
IterableOnceOps
Inherited from:
IterableOnceOps
def scan[B >: AbstractFile](z: B)(op: (B, B) => B): Iterable[B]
Inherited from:
IterableOps
def scanLeft[B](z: B)(op: (B, AbstractFile) => B): Iterable[B]
Inherited from:
IterableOps
def scanRight[B](z: B)(op: (AbstractFile, B) => B): Iterable[B]
Inherited from:
IterableOps
def size: Int
Inherited from:
IterableOnceOps
def sizeCompare(that: Iterable[_]): Int
Inherited from:
IterableOps
def sizeCompare(otherSize: Int): Int
Inherited from:
IterableOps
Inherited from:
IterableOps
def slice(from: Int, until: Int): Iterable[AbstractFile]
Inherited from:
IterableOps
Inherited from:
IterableOps
Inherited from:
IterableOps
Definition Classes
Inherited from:
IterableOps
def stepper[S <: Stepper[_]](implicit shape: StepperShape[AbstractFile, S]): S
Inherited from:
IterableOnce
def sum[B >: AbstractFile](implicit num: Numeric[B]): B
Inherited from:
IterableOnceOps
Inherited from:
IterableOps
override def tapEach[U](f: AbstractFile => U): Iterable[AbstractFile]
Definition Classes
Inherited from:
IterableOps
def to[C1](factory: Factory[AbstractFile, C1]): C1
Inherited from:
IterableOnceOps
Inherited from:
IterableOnceOps
final def toBuffer[B >: AbstractFile]: Buffer[B]
Inherited from:
IterableOnceOps
def toMap[K, V](implicit ev: AbstractFile <:< (K, V)): Map[K, V]
Inherited from:
IterableOnceOps
def toSet[B >: AbstractFile]: Set[B]
Inherited from:
IterableOnceOps
def transpose[B](implicit asIterable: AbstractFile => Iterable[B]): Iterable[Iterable[B]]
Inherited from:
IterableOps
def unzip[A1, A2](implicit asPair: AbstractFile => (A1, A2)): (Iterable[A1], Iterable[A2])
Inherited from:
IterableOps
def unzip3[A1, A2, A3](implicit asTriple: AbstractFile => (A1, A2, A3)): (Iterable[A1], Iterable[A2], Iterable[A3])
Inherited from:
IterableOps
Inherited from:
IterableOps
def zip[B](that: IterableOnce[B]): Iterable[(AbstractFile, B)]
Inherited from:
IterableOps
def zipAll[A1 >: AbstractFile, B](that: Iterable[B], thisElem: A1, thatElem: B): Iterable[(A1, B)]
Inherited from:
IterableOps

Deprecated and Inherited methods

@deprecated(message = "Use ++ instead of ++: for collections of type Iterable", since = "2.13.0")
def ++:[B >: AbstractFile](that: IterableOnce[B]): Iterable[B]
Deprecated
[Since version 2.13.0] Use ++ instead of ++: for collections of type Iterable
Inherited from:
IterableOps
@inline @deprecated(message = "Use foldLeft instead of /:", since = "2.13.0")
final def /:[B](z: B)(op: (B, AbstractFile) => B): B
Deprecated
[Since version 2.13.0] Use foldLeft instead of /:
Inherited from:
IterableOnceOps
@inline @deprecated(message = "Use foldRight instead of :\\", since = "2.13.0")
final def :\[B](z: B)(op: (AbstractFile, B) => B): B
Deprecated
[Since version 2.13.0] Use foldRight instead of :\\
Inherited from:
IterableOnceOps
@deprecated(message = "`aggregate` is not relevant for sequential collections. Use `foldLeft(z)(seqop)` instead.", since = "2.13.0")
def aggregate[B](z: => B)(seqop: (B, AbstractFile) => B, combop: (B, B) => B): B
Deprecated
[Since version 2.13.0] `aggregate` is not relevant for sequential collections. Use `foldLeft(z)(seqop)` instead.
Inherited from:
IterableOnceOps
@inline @deprecatedOverriding(message = "Use iterableFactory instead", since = "2.13.0") @deprecated(message = "Use iterableFactory instead", since = "2.13.0")
Deprecated
[Since version 2.13.0] Use iterableFactory instead
Inherited from:
IterableOps
@inline @deprecated(message = "Use `dest ++= coll` instead", since = "2.13.0")
final def copyToBuffer[B >: AbstractFile](dest: Buffer[B]): Unit
Deprecated
[Since version 2.13.0] Use `dest ++= coll` instead
Inherited from:
IterableOnceOps
@deprecated(message = "Check .knownSize instead of .hasDefiniteSize for more actionable information (see scaladoc for details)", since = "2.13.0")
Deprecated
[Since version 2.13.0] Check .knownSize instead of .hasDefiniteSize for more actionable information (see scaladoc for details)
Inherited from:
IterableOnceOps
@deprecated(message = "Use coll instead of repr in a collection implementation, use the collection value itself from the outside", since = "2.13.0")
Deprecated
[Since version 2.13.0] Use coll instead of repr in a collection implementation, use the collection value itself from the outside
Inherited from:
IterableOps
@deprecated(message = "Iterable.seq always returns the iterable itself", since = "2.13.0")
Deprecated
[Since version 2.13.0] Iterable.seq always returns the iterable itself
Inherited from:
Iterable
@deprecated(message = "toIterable is internal and will be made protected; its name is similar to `toList` or `toSeq`, but it doesn\'t copy non-immutable collections", since = "2.13.7")
Deprecated
[Since version 2.13.7] toIterable is internal and will be made protected; its name is similar to `toList` or `toSeq`, but it doesn\'t copy non-immutable collections
Inherited from:
Iterable
@inline @deprecated(message = "Use .iterator instead of .toIterator", since = "2.13.0")
Deprecated
[Since version 2.13.0] Use .iterator instead of .toIterator
Inherited from:
IterableOnceOps
@inline @deprecated(message = "Use .to(LazyList) instead of .toStream", since = "2.13.0")
Deprecated
[Since version 2.13.0] Use .to(LazyList) instead of .toStream
Inherited from:
IterableOnceOps
@deprecated(message = "toTraversable is internal and will be made protected; its name is similar to `toList` or `toSeq`, but it doesn\'t copy non-immutable collections", since = "2.13.0")
Deprecated
[Since version 2.13.0] toTraversable is internal and will be made protected; its name is similar to `toList` or `toSeq`, but it doesn\'t copy non-immutable collections
Inherited from:
IterableOps
@deprecated(message = "Use .view.slice(from, until) instead of .view(from, until)", since = "2.13.0")
def view(from: Int, until: Int): View[AbstractFile]
Deprecated
[Since version 2.13.0] Use .view.slice(from, until) instead of .view(from, until)
Inherited from:
IterableOps

Concrete fields