J.File

object File extends Ref.Custom.Type[File, File]
Source
__.scala
class Ref.Custom.Type[File, File]
class Object
trait Matchable
class Any

Member

opaque type Path

J.Path is an opaque value, backed by java.nio.file.Path

J.Path is an opaque value, backed by java.nio.file.Path

Source
__.scala
opaque type Path

J.Path is an opaque value, backed by java.nio.file.Path

J.Path is an opaque value, backed by java.nio.file.Path

Source
__.scala
opaque type Store

J.File.Store is an opaque value, backed by java.nio.file.FileStore

J.File.Store is an opaque value, backed by java.nio.file.FileStore

Source
Store.scala
opaque type Store

J.File.Store is an opaque value, backed by java.nio.file.FileStore

J.File.Store is an opaque value, backed by java.nio.file.FileStore

Source
Store.scala
opaque type System

J.File.System is an opaque value, backed by java.nio.file.FileSystem

J.File.System is an opaque value, backed by java.nio.file.FileSystem

Source
System.scala
opaque type System

J.File.System is an opaque value, backed by java.nio.file.FileSystem

J.File.System is an opaque value, backed by java.nio.file.FileSystem

Source
System.scala

Def

inline def apply(inline v: File): File
Source
__.scala
def copy(p: Path, overwrite: Boolean, copyAttr: Boolean): File

Copy to new location

Copy to new location

Copies this file to new location

Returns new File

 val p: J.Path = ~~("C:", "Temp", "Test.txt")

 val f1: J.File = p.fileMake.^(_.writeString("Foo"))

 val f2: J.File = f1.copy(p.parent + "Test2.txt")

 f2 tp            // Prints: C:\Temp\Test2.txt

 f2.readString tp // Prints: Foo
Source
__.scala
def delete: Boolean

Delete file

Delete file

Deletes file

Source
__.scala
def exists: Boolean

Check if exists

Check if exists

Usually returns true, unless was deleted just before

Source
__.scala
def extension: String

File extension

File extension

Returns the part of file name after last period

If no period in file name, empty String is returned

  val p = J.Path("C:", "Temp", "Test.txt")

  val f: J.File = p.fileMake

  f.path tp       // Prints: C:\Temp\Test.txt

  f.name tp       // Prints: Test.txt

  f.extension tp  // Prints: txt
Source
__.scala

Last updated time

Last updated time

Returns Time when this was last modified

Source
__.scala
def move(trgt: Path, overwrite: Boolean): File

Move file

Move file

Returns new File

 val p = J.Path("C:", "Temp", "Test.txt")

 val f1: J.File = p.fileMake.^(_.writeString("Foo"))

 val f2: J.File = f1.move(p.parent + "Test2.txt")

 f2 tp            // Prints: C:\Temp\Test2.txt

 f2.readString tp // Prints: Foo
Source
__.scala
def name: String

Name

Name

Last name without prior path $example

Source
__.scala

Create input

Create input

Opens J.Input to this file

Source
__.scala

Create output

Create output

Opens J.Output to this file

Source
__.scala
def path: Path

Path

Path

Returns J.Path to this $example

Source
__.scala
def readString: String

Read as String

Read as String

Reads this file as String

Full code = openInput.asText.readAllAndClose

Source
__.scala

File size

File size

Returns file ByteCount

  val p = J.Path("C:", "Temp", "Test.txt")

  val f: J.File = p.fileMake

  f.writeString("ABC" * 1000)

  f.size tp // Prints: 3.0kB
Source
__.scala
override def tag(v: File): String
Definition Classes
Source
__.scala
def temp: File

Creates temporary file

Creates temporary file

Creates new temporary file with this file as base

if App.^.TempPath? is available, this will be the directory, otherwise this file directory will be used

Temporary file name will be `this.name' plus '.temp' or '.temp1' or '.temp2' or '.temp3' or etc. if exists

 val p = J.Path("C:", "Temp", "Test.txt")

 val f: J.File = p.fileMake

 f.temp tp // Prints: C:\Temp\Test.txt.temp

 f.temp tp // Prints: C:\Temp\Test.txt.temp1

 f.temp tp // Prints: C:\Temp\Test.txt.temp2
Source
__.scala
def writeString(s: String): Unit

Write String

Write String

Writes String to this file, overwriting prior data

Full code =

 if (exists) delete;
 openOutput.asText.writeAllAndClose(s)
Source
__.scala

Inherited

def info(v: File): Info

Type to Info

Type to Info

Override this method to provide type standard Info implementation

Inherited from
Type
Source
Type.scala
final def isRef: Boolean
Inherited from
Type
Source
Type.scala
def isVoid(v: File): Boolean

Void check

Void check

Override this method to define which instances of this type are void

By default this method always returns false

If type supports void instances, then following inmpelentation should be added in most cases:

 implicit inline def xxRequest(inline v: \/) : <type> = <return void>
Inherited from
Type
Source
Type.scala
val name: String
Inherited from
Type
Source
Type.scala
inline def real: File
Inherited from
Type
Source
Type.scala