J.Path

opaque type Path

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

Source
__.scala

Def

inline def +(v: J.Path | String): J.Path
Inherited from
_methods
Source
_methods.scala
inline def ++(v: Stream[J.Path | String]): J.Path
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
def dropFirst(cnt: Int): J.Path
Inherited from
_methods
Source
_methods.scala
def dropLast(cnt: Int): J.Path
Inherited from
_methods
Source
_methods.scala
Inherited from
_methods
Source
_methods.scala
def dropRange(f: Int, sz: 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
def fileOpt: Opt[J.File]
Inherited from
_methods
Source
_methods.scala

Sub-path index

Sub-path index

Optionally returns matching sub-path start index

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

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

  path indexOpt "ddd" , "ccc" tp  // Prints: Opt(VOID)
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: Stream[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.

This is a zero cost call.

Inherited from
_methods
Source
Base.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

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

Optional root

Optional root

Optionally returns root Path if available

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

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

 p.rootDrop.rootOpt.tp //     prints: Opt(VOID)
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
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
Inherited from
_methods
Source
_methods.scala
def takeRange(start: Int, size: Int): J.Path
Inherited from
_methods
Source
_methods.scala