J.Path

opaque type Path

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

Source
__.scala

Def

@scala.annotation.targetName("_join")
inline def +(inline v: J.Path | String): J.Path
Inherited from
_methods
Source
_methods.scala
@scala.annotation.targetName("_joinAll")
inline def ++(inline v: ~[J.Path | String]): J.Path
Inherited from
_methods
Source
_methods.scala
@scala.annotation.targetName("child_Stream")
Inherited from
_methods
Source
_methods.scala
@scala.annotation.targetName("childRecursive_Stream")
Inherited from
_methods
Source
_methods.scala
def contains(name: String, more: String*): Boolean
Inherited from
_methods
Source
_methods.scala
def contains(v: J.Path): Boolean
Inherited from
_methods
Source
_methods.scala
inline def delete: Boolean
Inherited from
_methods
Source
_methods.scala
@scala.annotation.targetName("drop_Range")
Inherited from
_methods
Source
_methods.scala
@scala.annotation.targetName("drop_Range")
def drop_<>(f: Int, sz: Int): J.Path
Inherited from
_methods
Source
_methods.scala
def dropFirst(cnt: Int): J.Path
Inherited from
_methods
Source
_methods.scala
def dropLast(cnt: Int): J.Path
Inherited from
_methods
Source
_methods.scala
inline def endsWith(p: J.Path): Boolean

Checks end match

Checks end match

Returns true if this Path ends with p

   val path: J.Path = "aaa" , "bbb" + "ccc" + "ddd"

   path endsWith "ccc" , "ddd" tp // Prints: true

   path endsWith "aaa" , "bbb" tp // Prints: false
Inherited from
_methods
Source
_methods.scala
inline def exists: Boolean

Check exists

Check exists

Returns true this Path exists in the file system as file or directory

Inherited from
_methods
Source
_methods.scala
def file: J.File
Inherited from
_methods
Source
_methods.scala
@scala.annotation.targetName("file_Opt")
Inherited from
_methods
Source
_methods.scala
@scala.annotation.targetName("index_Opt")

Sub-path index

Sub-path index

Optionally returns matching sub-path start index

  val path: J.Path = "aaa" , "bbb" + "ccc" + "ddd" + "eee"

  path index_? "ccc" , "ddd" tp  // Prints: Opt(2)

  path index_? "ddd" , "ccc" tp  // Prints: Opt(\/)
Inherited from
_methods
Source
_methods.scala
inline def isDirectory: Boolean
Inherited from
_methods
Source
_methods.scala
inline def isEmpty: Boolean
Inherited from
_methods
Source
_methods.scala
inline def isFile: Boolean
Inherited from
_methods
Source
_methods.scala
def join(v: J.Path | String): J.Path
Inherited from
_methods
Source
_methods.scala
def joinAll(v: ~[J.Path | String]): J.Path
Inherited from
_methods
Source
_methods.scala
inline def lastName: String

Last name

Last name

Returns last name in the Path hierarchy

If this Path points to a file, lastName is the name of file

   val path : J.Path =  "Temp" , "Test.txt"

   path.lastName tp  // Prints: Test.txt
Inherited from
_methods
Source
_methods.scala
def make: Unit
Inherited from
_methods
Source
_methods.scala
def name(idx: Int): String
Inherited from
_methods
Source
_methods.scala
inline def names: Idx[String]
Inherited from
_methods
Source
_methods.scala
inline def normalize: J.Path
Inherited from
_methods
Source
_methods.scala
inline def parent: J.Path

Parent Path

Parent Path

Returns parent Path of this Path

  val p: J.Path = "aaa" , "bbb" + "ccc"

  p.parent tp  // Prints: aaa\bbb
Inherited from
_methods
Source
_methods.scala
inline def real: java.nio.file.Path

Real value

Real value

Returns real value standing behind the opaque type

Inherited from
_methods
Source
Type.scala
def root: J.Path

Root path

Root path

Returns root Path

Note: Fails if no root available

  J.Path.get.root tp // May print: C:\
Inherited from
_methods
Source
_methods.scala
@scala.annotation.targetName("root_Opt")

Optional root

Optional root

Optionally returns root Path if available

 val p = J.Path("aaa" , "bbb").rootMake

 p.root_? tp           // May print: Opt(C:\)

 p.rootDrop.root_? tp //     prints: Opt(\/)
Inherited from
_methods
Source
_methods.scala

Looses root if any

Looses root if any

If this Path has a root, new Path without root is returned

Otherwise this Path is returned as is

  val p = J.Path("aaa" , "bbb").rootMake

  p tp           // May print: C:\aaa\bbb

  p.rootDrop tp  // May print: aaa\bbb
Inherited from
_methods
Source
_methods.scala

Makes root if none

Makes root if none

If this Path has no root, new Path with current root is returned

Otherwise this Path is returned as is

 val p: J.Path = "aaa" , "bbb"

 p tp           // May print: aaa\bbb

 p.rootMake tp  // May print: C:\aaa\bbb
Inherited from
_methods
Source
_methods.scala
def size: Int
Inherited from
_methods
Source
_methods.scala
inline def startsWith(p: J.Path): Boolean

Checks start match

Checks start match

Returns true if this Path starts with p

   val path: J.Path = "aaa" , "bbb" + "ccc" + "ddd"

   path startsWith "aaa" , "bbb" tp  // Prints: true

   path startsWith "bbb" , "aaa" tp  // Prints: false
Inherited from
_methods
Source
_methods.scala
@scala.annotation.targetName("take_Range")
Inherited from
_methods
Source
_methods.scala
@scala.annotation.targetName("take_Range")
def take_<>(start: Int, size: Int): J.Path
Inherited from
_methods
Source
_methods.scala
def takeAfter(p: J.Path, dflt: J.Path): J.Path

Sub-path after

Sub-path after

Returns sub-path after p

Value Params
default

path if p is not found. If not specified, default is the original path

  val p: J.Path = "aaa" , "bbb" + "ccc" + "ddd" + "eee" + "fff"
  p tp                                             // Prints: aaa\bbb\ccc\ddd\eee\fff
  p subpathAfter "ccc" , "ddd" tp                    // Prints: eee\fff
  p subpathAfter "ddd" , "ccc" tp                    // Prints: aaa\bbb\ccc\ddd\eee\fff
  p subpathAfter ("ddd" , "ccc", "xyz" , "bbc") tp  // Prints: xyz\bbc
p

sub-path to copy after

Inherited from
_methods
Source
_methods.scala
def takeBefore(p: J.Path, dflt: J.Path): J.Path

Sub-path before

Sub-path before

Returns sub-path from start to p

Value Params
default

path if p is not found. If not specified, default is the original path

  val p: J.Path = "aaa" , "bbb" + "ccc" + "ddd" + "eee" + "fff"
  p tp                                            // Prints: aaa\bbb\ccc\ddd\eee\fff
  p subpathBefore "ccc" , "ddd" tp                   // Prints: aaa\bbb
  p subpathBefore "ddd" , "ccc" tp                   // Prints: aaa\bbb\ccc\ddd\eee\fff
  p subpathBefore ("ddd" , "ccc", "xyz" , "bbc") tp  // Prints: xyz\bbc
p

sub-path to copy up to

Inherited from
_methods
Source
_methods.scala
def takeFirst(cnt: Int): J.Path
Inherited from
_methods
Source
_methods.scala
def takeFrom(p: J.Path, dflt: J.Path): J.Path

Sub-path from

Sub-path from

Returns sub-path starting from specified Path

Value Params
default

path if p is not found. If not specified, default is the original path

  val p: J.Path = "aaa" , "bbb" + "ccc" + "ddd" + "eee" + "fff"
  p tp                                         // Prints: aaa\bbb\ccc\ddd\eee\fff
  p subpathFrom "ccc" , "ddd" tp                  // Prints: ccc\ddd\eee\fff
  p subpathFrom "ddd" , "ccc" tp                  // Prints: aaa\bbb\ccc\ddd\eee\fff
  p subpathFrom ("ddd" , "ccc", "xyz" , "bbc") tp // Prints: xyz\bbc
p

sub-path to copy from

Inherited from
_methods
Source
_methods.scala
def takeLast(cnt: Int): J.Path
Inherited from
_methods
Source
_methods.scala

Implicit

implicit inline def implicitFromFile(inline v: J.File): J.Path
Source
__.scala
implicit inline def implicitFromReal(inline v: java.nio.file.Path): J.Path
Source
__.scala
implicit inline def implicitFromString(inline v: String): J.Path
Source
__.scala
implicit inline def implicitRequest(inline v: \/): J.Path

General void instance request

General void instance request

It is possible to use general request \/ to get void instance of this type, thanks to this implicit conversion.

Source
__.scala