public class PathBuilder
extends java.lang.Object
implements java.lang.Iterable<java.lang.String>
Path.
Since Paths are immutable, you have to construct them in one go and
not change them. This is a mutable path; it has methods for building a Path
from scratch, or modifying an existing Path structure.
Copyright 2006-2007 Partner Software, Inc.
| Constructor and Description |
|---|
PathBuilder()
Creates a builder initialized with an empty, relative Path.
|
PathBuilder(boolean absolute,
java.lang.String... parts)
Creates a builder initialized with the given parts and absoluteness
|
PathBuilder(Path source)
Creates a builder based upon the given Path.
|
PathBuilder(PathBuilder nother)
Creates a builder with the same contents as the given builder.
|
PathBuilder(java.lang.String... parts)
Creates a builder initialized with the given parts; absolute is false.
|
PathBuilder(java.lang.String pathString)
Creates a builder and initializes it by parsing the given path string.
|
| Modifier and Type | Method and Description |
|---|---|
void |
invert()
Inverts the path, so that the parts are in reverse order.
|
boolean |
isAbsolute()
Is this path absolute?
|
java.util.Iterator<java.lang.String> |
iterator() |
java.lang.String |
pop()
Removes and returns the last part of the path.
|
void |
push(java.lang.String name)
Adds a part to the path.
|
void |
pushArray(java.lang.String[] parts)
Treats the given array as a path, and pushes all parts just like
pushPath(Path). |
void |
pushFileString(java.lang.String fileString)
Pushes the path, given as a file-encoded String.
|
void |
pushPath(Path nother)
Pushes all parts of the given Path onto this one.
|
void |
pushPathString(java.lang.String pathString)
Pushes the path, given as a path-encoded String.
|
void |
setAbsolute(boolean tizit)
Set whether path is absolute.
|
java.lang.String[] |
toArray()
Returns an array copy of the path's parts.
|
Path |
toPath()
The actual goal of building a path is to create a path.
|
java.lang.String |
toString() |
public PathBuilder()
public PathBuilder(Path source)
source - path to start withpublic PathBuilder(PathBuilder nother)
nother - builder to copypublic PathBuilder(java.lang.String pathString)
pathString - string representation of initial path for builderpublic PathBuilder(boolean absolute,
java.lang.String... parts)
parts - parts of the pathabsolute - true if an absolute pathpublic PathBuilder(java.lang.String... parts)
parts - parts of the pathpublic Path toPath()
public void push(java.lang.String name)
name - part name to add to the pathpublic java.lang.String pop()
public void pushPath(Path nother)
nother - path to push onto currently built pathpublic void pushPathString(java.lang.String pathString)
public void pushFileString(java.lang.String fileString)
public void pushArray(java.lang.String[] parts)
pushPath(Path).parts - public boolean isAbsolute()
public void setAbsolute(boolean tizit)
tizit - true if path is absolutepublic java.lang.String[] toArray()
public java.util.Iterator<java.lang.String> iterator()
iterator in interface java.lang.Iterable<java.lang.String>public void invert()
public java.lang.String toString()
toString in class java.lang.Object