public final class JkPathSequence
extends java.lang.Object
implements java.lang.Iterable<java.nio.file.Path>, java.io.Serializable
entry
.Modifier and Type | Method and Description |
---|---|
JkPathSequence |
and(java.lang.Iterable<java.nio.file.Path> otherEntries)
Returns a
JkPathSequence made of, in the order, the entries of this
one plus the specified ones. |
JkPathSequence |
and(java.nio.file.Path path1,
java.nio.file.Path path2,
java.nio.file.Path... others) |
JkPathSequence |
andPrepend(java.lang.Iterable<java.nio.file.Path> paths)
Returns a
JkPathSequence made of the specified entries followed by the sequence entries of this object. |
JkPathSequence |
andPrepend(java.nio.file.Path path1,
java.nio.file.Path path2,
java.nio.file.Path... entries) |
boolean |
equals(java.lang.Object o) |
java.nio.file.Path |
findEntryContainingClass(java.lang.String className)
Returns the first entry of this
classpath containing the given class. |
java.util.List<java.nio.file.Path> |
getEntries()
Returns this sequence as a list.
|
java.nio.file.Path |
getEntry(int index) |
int |
hashCode() |
boolean |
hasNonExisting() |
java.util.Iterator<java.nio.file.Path> |
iterator() |
JkPathSequence |
normalized() |
static JkPathSequence |
of() |
static JkPathSequence |
of(java.lang.Iterable<java.nio.file.Path> paths)
Creates a
JkPathSequence from an Iterable of paths or a single Path. |
static JkPathSequence |
of(java.nio.file.Path path1,
java.nio.file.Path path2,
java.nio.file.Path... others)
Creates a
JkPathSequence form specified entries |
static JkPathSequence |
of(java.nio.file.Path baseDir,
java.lang.String relativePathsAsString)
Creates a
JkPathSequence from a base directory and string of
relative paths separated with a ";". |
static JkPathSequence |
ofPathString(java.lang.String pathString) |
static JkPathSequence |
ofSysPropClassPath()
Returns the current classpath as given by
System.getProperty("java.class.path") . |
static JkPathSequence |
readFrom(java.nio.file.Path path)
Reads the contents of a file at the given path and returns a JkPathSequence object representing
the paths extracted from the file contents.
|
static JkPathSequence |
readFromQuietly(java.nio.file.Path path)
Same as
readFrom(java.nio.file.Path) but returns an empty {@link JkPathSequence if the file does not exist. |
JkPathSequence |
relativizeFromWorkingDir()
Returns an identical path sequence but replacing relative paths with absolute paths resolved from the
specified base directory.
|
JkPathSequence |
resolvedTo(java.nio.file.Path baseDir)
Returns an identical path sequence but replacing relative paths with absolute paths resolved from the
specified base directory.
|
java.lang.String |
toColonSeparatedPath()
Returns the file names concatenated with ':'
|
java.lang.String |
toPath()
Returns the file names concatenated with ';' on Windows and ':' on unix.
|
java.lang.String |
toPathMultiLine(java.lang.String margin) |
java.util.Set<java.nio.file.Path> |
toSet() |
java.lang.String |
toString() |
java.net.URL[] |
toUrls() |
JkPathSequence |
withoutDuplicates()
Returns a
JkPathSequence identical to this one but without duplicates. |
void |
writeTo(java.nio.file.Path path)
Writes the contents of this JkPathSequence to the specified file path.
|
public static JkPathSequence of(java.lang.Iterable<java.nio.file.Path> paths)
JkPathSequence
from an Iterable
of paths or a single Path.paths
- As Path
class implements { @link IterablePath
instance, if so it will be interpreted as a list containing a single element which is this argument.public static JkPathSequence of()
public static JkPathSequence readFrom(java.nio.file.Path path)
writeTo(java.nio.file.Path)
java.io.UncheckedIOException
- if the file does not exist.public static JkPathSequence readFromQuietly(java.nio.file.Path path)
readFrom(java.nio.file.Path)
but returns an empty {@link JkPathSequence if the file does not exist.public static JkPathSequence ofPathString(java.lang.String pathString)
public static JkPathSequence of(java.nio.file.Path baseDir, java.lang.String relativePathsAsString)
JkPathSequence
from a base directory and string of
relative paths separated with a ";".public static JkPathSequence of(java.nio.file.Path path1, java.nio.file.Path path2, java.nio.file.Path... others)
JkPathSequence
form specified entriespublic static JkPathSequence ofSysPropClassPath()
System.getProperty("java.class.path")
.public JkPathSequence withoutDuplicates()
JkPathSequence
identical to this one but without duplicates.
If a given file in this sequence exist twice or more, then only the first occurrence is kept in the returned
sequence.public JkPathSequence normalized()
public java.util.List<java.nio.file.Path> getEntries()
public java.nio.file.Path getEntry(int index)
public java.util.Iterator<java.nio.file.Path> iterator()
iterator
in interface java.lang.Iterable<java.nio.file.Path>
public JkPathSequence andPrepend(java.nio.file.Path path1, java.nio.file.Path path2, java.nio.file.Path... entries)
andPrepend(Iterable)
public JkPathSequence andPrepend(java.lang.Iterable<java.nio.file.Path> paths)
JkPathSequence
made of the specified entries followed by the sequence entries of this object.paths
- As Path
class implements { @link IterablePath
instance, if so it will be interpreted as a list containing a single element which is this argument.public JkPathSequence and(java.nio.file.Path path1, java.nio.file.Path path2, java.nio.file.Path... others)
and(Iterable)
public JkPathSequence and(java.lang.Iterable<java.nio.file.Path> otherEntries)
JkPathSequence
made of, in the order, the entries of this
one plus the specified ones.public JkPathSequence resolvedTo(java.nio.file.Path baseDir)
public JkPathSequence relativizeFromWorkingDir()
public java.lang.String toPath()
public java.lang.String toColonSeparatedPath()
public java.lang.String toPathMultiLine(java.lang.String margin)
public java.util.Set<java.nio.file.Path> toSet()
public java.net.URL[] toUrls()
public boolean hasNonExisting()
public java.nio.file.Path findEntryContainingClass(java.lang.String className)
classpath
containing the given class.public void writeTo(java.nio.file.Path path)
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object