de.jaret.util.misc
Class MiscUtil

java.lang.Object
  extended by de.jaret.util.misc.MiscUtil

public class MiscUtil
extends Object

Some static helper methods (mainly concerned with String manipulation).

Version:
$Id: MiscUtil.java 250 2007-02-12 00:15:49Z olk $
Author:
Peter Kliem

Constructor Summary
MiscUtil()
           
 
Method Summary
static void copyFile(File srcFile, File destFile)
           
static String getFilename(String path)
          Retrieve the filename from a complete path string.
static String getPath(String path)
          Extract path from a complete path including filename.
static String leftTrim(String str)
          Removes leading whitespaces.
static StringBuffer readTextFile(String completePath)
          Read a textfile into a StringBuffer.
static String rightTrim(String str)
          Removes trailing whitespaces.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MiscUtil

public MiscUtil()
Method Detail

getFilename

public static String getFilename(String path)
Retrieve the filename from a complete path string.

Parameters:
path - path including filename (path separator "/" or "\")
Returns:
filename (last part of the path)

getPath

public static String getPath(String path)
Extract path from a complete path including filename.

Parameters:
path - path including filename (path separator "/" or "\")
Returns:
path (path without last element)

readTextFile

public static StringBuffer readTextFile(String completePath)
Read a textfile into a StringBuffer.

Parameters:
completePath - complete path of the file
Returns:
StringBuffer

copyFile

public static void copyFile(File srcFile,
                            File destFile)
                     throws IOException
Throws:
IOException

leftTrim

public static String leftTrim(String str)
Removes leading whitespaces.

Parameters:
str - String to treat
Returns:
str without leading whitespaces

rightTrim

public static String rightTrim(String str)
Removes trailing whitespaces.

Parameters:
str - String to treat
Returns:
str without trailing whitespaces


Copyright © 2013. All Rights Reserved.