net.sf.statcvs.util
public class FileUtils extends Object
Constructor and Description |
---|
FileUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
copyFile(InputStream in,
File out)
Copy a InputStream into a File
|
static void |
copyFile(String inputName,
String destination)
Copies a file to a specified destination
|
static String |
getAbsoluteName(String path,
String filename)
Concatenates
path and filename to an
absolute filename by inserting the system file separator. |
static String |
getDefaultDirSeparator()
Returns the java path separator
|
static String |
getDirectoryName(String path)
Returns the last component of a directory path.
|
static String |
getDirSeparator()
Returns the os dependent path separator
|
static String |
getFilenameWithoutPath(String filename)
Takes a filename with path and returns just the filename.
|
static String |
getParentDirectoryPath(String path)
Returns all but the last component of a directory path
|
static String |
getPathWithoutEndingSlash(String path)
Deletes the ending directory separator of a
given
path if there is one and returns
the result. |
static String |
readTextFromURL(String urlTxt)
Read a full file into a string.
|
public static void copyFile(String inputName, String destination) throws FileNotFoundException, IOException
inputName
- Filedestination
- FilenameFileNotFoundException
- if no input file existsIOException
- if cannot read or writepublic static void copyFile(InputStream in, File out) throws FileNotFoundException, IOException
in
- sourceout
- destinationFileNotFoundException
- if not foundIOException
- if read/write errorpublic static String getFilenameWithoutPath(String filename)
filename
- a filename with pathpublic static String getDirSeparator()
public static String getDefaultDirSeparator()
public static String getPathWithoutEndingSlash(String path)
path
if there is one and returns
the result.
Otherwise the path is unhandled returned.
The separator is the one used bye the
underlying operating system and it is the one returned
bye the getDirSeparator()
method.
path
- The path
to delete the directory
separator from.path
without the ending
directory separator.getDirSeparator()
public static String getAbsoluteName(String path, String filename)
path
and filename to an
absolute filename by inserting the system file separator.path
- The path to use.filename
- The filename for concatenation.public static String getDirectoryName(String path)
path
- a directory, ending in "/", for example "src/net/sf/statcvs/"public static String getParentDirectoryPath(String path)
path
- a directory, ending in "/", for example "src/net/sf/statcvs/"