de.schlichtherle.io.util
Class Paths

java.lang.Object
  extended by de.schlichtherle.io.util.Paths
Direct Known Subclasses:
Path

Deprecated. This class will vanish in the next release.

public class Paths
extends Object

Utility methods for file path names.

Version:
TrueZIP 6.7
Author:
Christian Schlichtherle

Constructor Summary
protected Paths()
          Deprecated. You cannot instantiate this class.
 
Method Summary
static String cutTrailingSeparator(String path, char separatorChar)
          Deprecated. This method chops off a single trailing separator only. Use cutTrailingSeparators(java.lang.String, char) to chop off multiple trailing separators.
static String cutTrailingSeparators(String path, char separatorChar)
          Deprecated. Cuts off any separator characters at the end of the path, unless the path contains of only separator characters, in which case a single separator character is retained to denote the root directory.
static String normalize(String path)
          Deprecated. Equivalent to normalize(path, File.separatorChar).
static String normalize(String path, char separatorChar)
          Deprecated. Removes all redundant separators, dot directories (".
static String[] split(String path)
          Deprecated. Equivalent to split(path, File.separatorChar).
static String[] split(String path, char separatorChar)
          Deprecated. Splits a path into its parent path and its base name, recognizing platform specific file system roots.
static String[] split(String path, char separatorChar, String[] split)
          Deprecated. Same as split(String, char), but uses the given array split to store the result.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Paths

protected Paths()
Deprecated. 
You cannot instantiate this class.

Method Detail

normalize

public static final String normalize(String path)
Deprecated. 
Equivalent to normalize(path, File.separatorChar).


normalize

public static String normalize(String path,
                               char separatorChar)
Deprecated. 
Removes all redundant separators, dot directories (".") and dot-dot directories ("..") from the path and returns the result. An empty path results in ".". On Windows, a path may be prefixed by a drive letter followed by a colon. On all platforms, a path may be prefixed by two leading separators to indicate a UNC, although this is currently supported on Windows only. A single trailing separator character is always retained if present.

Parameters:
path - The path to normalize.
separatorChar - The path separator.
Returns:
path if it was already in normalized form. Otherwise, a new String with the normalized form of the given path.
Throws:
NullPointerException - If path is null.

cutTrailingSeparators

public static final String cutTrailingSeparators(String path,
                                                 char separatorChar)
Deprecated. 
Cuts off any separator characters at the end of the path, unless the path contains of only separator characters, in which case a single separator character is retained to denote the root directory.

Returns:
path if it's a path without trailing separators or contains the separator only. Otherwise, the substring until the first of at least one separating characters is returned.
Throws:
NullPointerException - If path is null.

cutTrailingSeparator

public static final String cutTrailingSeparator(String path,
                                                char separatorChar)
Deprecated. This method chops off a single trailing separator only. Use cutTrailingSeparators(java.lang.String, char) to chop off multiple trailing separators.

Cuts off a trailing separator character of the pathname, unless the pathname contains of only the separator character (i.e. denotes the root directory).

Returns:
path if it's a path without a trailing separator or contains the separator only. Otherwise, the substring up to the last character is returned.
Throws:
NullPointerException - If path is null.

split

public static final String[] split(String path)
Deprecated. 
Equivalent to split(path, File.separatorChar).


split

public static final String[] split(String path,
                                   char separatorChar)
Deprecated. 
Splits a path into its parent path and its base name, recognizing platform specific file system roots.

Parameters:
path - The name of the path which's parent path and base name are to be returned.
separatorChar - The path separator to use for this operation.
Returns:
An array of at least two strings:
  1. Index 0 holds the parent path or null if the path does not specify a parent. This name compares equal with File.getParent(), except that redundant separators left of the parent path's base name are kept (base.e. empty path elements between two separators left of the parent path's base name are not removed).
  2. Index 1 holds the base name. This name compares equal with File.getName().
Throws:
NullPointerException - If path is null.

split

public static String[] split(String path,
                             char separatorChar,
                             String[] split)
Deprecated. 
Same as split(String, char), but uses the given array split to store the result.

Parameters:
split - An array of at least two String elements to hold the result.
Returns:
split