Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

RSE
Release 3.0

org.eclipse.rse.services.clientserver
Class PathUtility


java.lang.Object
  extended by 
org.eclipse.rse.services.clientserver.PathUtility

public class PathUtility
extends Object


Constructor Summary
PathUtility ()
           
 
Method Summary
static  String enQuoteUnix ( String s)
          Quotes a string such that it can be used in a remote UNIX shell.
static  String getSeparator ( String path)
          Given a path name, try to guess what separator is used.
static  String normalizeUnix ( String path)
          Deprecated. this should not be used since \ is a valid part of UNIX file names. Also, a better normalizer would also consider swquences like a/../b and a/./b -- Try to work without this method.
static  String normalizeUnknown ( String path)
           
static  String normalizeVirtualUnix ( String path)
           
static  String normalizeVirtualWindows ( String path)
           
static  String normalizeWindows ( String path)
          Normalize a path name that is supposed to be Windows style.
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PathUtility

public PathUtility()
Method Detail

normalizeWindows

public static 
String normalizeWindows(
String path)
Normalize a path name that is supposed to be Windows style. Replaces / characters by \ and remove duplicate \ characters.

Parameters:
path - a path to normalize
Returns:
a normalized path.

normalizeUnix

public static 
String normalizeUnix(
String path)
Deprecated. this should not be used since \ is a valid part of UNIX file names. Also, a better normalizer would also consider swquences like a/../b and a/./b -- Try to work without this method.

Normalize a path name that is supposed to be UNIX style. Replaces \ characters by / and remove duplicate / characters.

Parameters:
path - a path to normalize
Returns:
a normalized path.

normalizeVirtualWindows

public static 
String normalizeVirtualWindows(
String path)

normalizeVirtualUnix

public static 
String normalizeVirtualUnix(
String path)

normalizeUnknown

public static 
String normalizeUnknown(
String path)

getSeparator

public static 
String getSeparator(
String path)
Given a path name, try to guess what separator is used. Should only be used for absolute path names, but tries to compute a good fallback in case of relative path names as well.

Parameters:
path - a path to check
Returns:
a separator String for the given path: either "/" or "\\"

enQuoteUnix

public static 
String enQuoteUnix(
String s)
Quotes a string such that it can be used in a remote UNIX shell. This has been tested with sh, bash and tcsh shells. On Windows, special characters likes quotes and dollar sign. and - most importantly - the backslash will not be quoted correctly. Newline is only quoted correctly in tcsh. But since this is mainly intended for file names, it should work OK in almost every case.

Parameters:
s - String to be quoted
Returns:
quoted string, or original if no quoting was necessary.

RSE
Release 3.0

Copyright (c) IBM Corporation and others 2000, 2008. All Rights Reserved.

 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire