|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.statcvs.util.FileUtils
Some helpful file functions TODO: Remove redundancy, write tests
Constructor Summary | |
FileUtils()
|
Method Summary | |
static void |
copyFile(java.io.InputStream in,
java.io.File out)
Copy a InputStream into a File |
static void |
copyFile(java.lang.String inputName,
java.lang.String destination)
Copies a file to a specified destination |
static java.lang.String |
getAbsoluteName(java.lang.String path,
java.lang.String filename)
Concatenates path and filename to an
absolute filename by inserting the system file separator. |
static java.lang.String |
getDefaultDirSeparator()
Returns the java path separator |
static java.lang.String |
getDirectoryName(java.lang.String path)
Returns the last component of a directory path. |
static java.lang.String |
getDirSeparator()
Returns the os dependent path separator |
static java.lang.String |
getFilenameWithoutPath(java.lang.String filename)
Takes a filename with path and returns just the filename. |
static java.lang.String |
getParentDirectoryPath(java.lang.String path)
Returns all but the last component of a directory path |
static java.lang.String |
getPathWithoutEndingSlash(java.lang.String path)
Deletes the ending directory separator of a given path if there is one and returns
the result. |
static java.lang.String |
readTextFromURL(java.lang.String urlTxt)
Read a full file into a string. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public FileUtils()
Method Detail |
public static void copyFile(java.lang.String inputName, java.lang.String destination) throws java.io.FileNotFoundException, java.io.IOException
inputName
- Filedestination
- Filename
java.io.FileNotFoundException
- if no input file exists
java.io.IOException
- if cannot read or writepublic static void copyFile(java.io.InputStream in, java.io.File out) throws java.io.FileNotFoundException, java.io.IOException
in
- sourceout
- destination
java.io.FileNotFoundException
- if not found
java.io.IOException
- if read/write errorpublic static java.lang.String getFilenameWithoutPath(java.lang.String filename)
filename
- a filename with path
public static java.lang.String getDirSeparator()
public static java.lang.String getDefaultDirSeparator()
public static java.lang.String getPathWithoutEndingSlash(java.lang.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 java.lang.String getAbsoluteName(java.lang.String path, java.lang.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 java.lang.String getDirectoryName(java.lang.String path)
path
- a directory, ending in "/", for example "src/net/sf/statcvs/"
public static java.lang.String getParentDirectoryPath(java.lang.String path)
path
- a directory, ending in "/", for example "src/net/sf/statcvs/"
public static java.lang.String readTextFromURL(java.lang.String urlTxt)
urlTxt
- URL of the text to get
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |