|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Path
The Path
represents the path part of a URI. This provides
the various components of the URI path to the user. The normalization
of the path is the conversion of the path given into it's actual path by
removing the references to the parent directorys and to the current dir.
If the path that this represents is /usr/bin/../etc/./README
then the actual path, normalized, is /usr/etc/README
. This
will also provide a localization from the path. The localization is there
if a second extension exists within the path, for example if the path was
/usr/bin/file.ext.ext
. The second extension will be parsed so
that all the characters before the first underscore character, '_', will
define the language and all the characters after the first underscore will
define the country, for example index.en_US.html
will have
the language en and the country would be US. This should only support two
character codes for both language and country.
PathParser
Method Summary | |
---|---|
java.lang.String |
getCountry()
This will return the country that this path has taken from the locale of the path. |
java.lang.String |
getDirectory()
This will return the highest directory that exists within the path. |
java.lang.String |
getExtension()
This will return the extension that the file name contains. |
java.lang.String |
getLanguage()
This will return the language that this path has taken from the locale of the path. |
java.lang.String |
getName()
This will return the full name of the file without the path. |
java.lang.String |
getPath()
This will return the normalized path. |
java.lang.String |
getRelative(java.lang.String path)
This will return the path as it is relative to the issued path. |
java.lang.String[] |
getSegments()
This method is used to break the path into individual parts called segments, see RFC 2396. |
java.lang.String |
toString()
This will return the normalized path. |
Method Detail |
---|
java.lang.String getLanguage()
file.en_US.extension
produces a language
of en
. This will return null if there was
no language information within the path.
java.lang.String getCountry()
file.en_US.extension
produces a country
of US
. This will return null if there was
no country information within the path.
java.lang.String getExtension()
file.en_US.extension
will produce an extension of extension
. This
will return null if the path contains no file extension.
java.lang.String getName()
/usr/README
the name is README
.
Also for directorys the name of the directory in the last
path segment is returned. This returns the name without any
of the path parameters. As RFC 2396 defines the path to have
path parameters after the path segments.
java.lang.String getPath()
/usr/../etc/./
the
path is /etc/
. If the path that this represents
is a path with an immediate back reference then this will
return null. This is the path with all its information even
the parameter information if it was defined in the path.
../
or ./
java.lang.String[] getSegments()
/usr/bin/../etc
then the segments
returned would be usr
and etc
as
the path is normalized before the segments are extracted.
java.lang.String getDirectory()
/pub/./bin/README
would be to return
the highest directory path /pub/bin/
. The "/"
character will allways be the last character in the path.
java.lang.String getRelative(java.lang.String path)
getDirectory
. This is useful if paths
that are relative to a specific location are required. To
illustrate what this method will do the following example
is provided. If this object represented the path string
/usr/share/rfc/rfc2396.txt
and the issued
path was /usr/share/text.txt
then this will
return the path string /rfc/rfc2396.txt
.
path
- the path prefix to acquire a relative path
java.lang.String toString()
/usr/../etc/./
the
path is /etc/
. If the path that this represents
is a path with an immediate back reference then this will
return null. This is the path with all its information even
the parameter information if it was defined in the path.
toString
in class java.lang.Object
../
or ./
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |