|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openadaptor.util.FileUtils
public class FileUtils
Field Summary | |
---|---|
(package private) static org.apache.log4j.Logger |
log
|
Constructor Summary | |
---|---|
FileUtils()
|
Method Summary | |
---|---|
static void |
appendTimeStamp(java.lang.StringBuffer sb)
Appends current time to String buffer in a Timestamp format. |
static void |
deleteFile(java.lang.String fileName)
deletes the supplied file. |
static boolean |
deleteFileFailSilently(java.lang.String fileName)
deletes the supplied file. |
static boolean |
fileExists(java.lang.String fileName)
checks that the file corresponding to the file name passed is valid (ie. |
static java.io.Reader |
fileReaderWithEncoding(java.lang.String filename,
java.lang.String enc)
Opens a Reader on a file encoded with the supplied encodingg format. |
static long |
getLineCount(java.lang.String fileName)
returns the number of lines in the file defined by the file name supplied |
static java.lang.String |
newFilenameFromPattern(java.lang.String pattern)
Creates a filename from the pattern string supplied. |
static java.io.FileWriter |
newFileWriterFromPattern(java.lang.String pattern,
boolean append)
Creates a FileWriter on a file whose name is generated from pattern. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static org.apache.log4j.Logger log
Constructor Detail |
---|
public FileUtils()
Method Detail |
---|
public static java.io.FileWriter newFileWriterFromPattern(java.lang.String pattern, boolean append) throws java.io.IOException
pattern
- Filename pattern.append
- Append to any existing file?
java.io.IOException
- If we cannot create the new file for writing.public static java.lang.String newFilenameFromPattern(java.lang.String pattern) throws java.io.IOException
pattern
- Pattern string for filename.
java.io.IOException
public static void appendTimeStamp(java.lang.StringBuffer sb)
public static java.io.Reader fileReaderWithEncoding(java.lang.String filename, java.lang.String enc) throws java.io.FileNotFoundException, java.io.UnsupportedEncodingException, java.io.IOException
Opens a Reader on a file encoded with the supplied encodingg format. Supported formats are the standard Java encodings (UTF-8, ISO-8859-1 etc.). You may use an URL in the InputFileName property. The FileSource will attempt to connect to the remote server and open an InputStream to the file using the java.net.URL libraries. Note that you must include the protocol indicator at the start of the URL for this to work. A.C1.InputFileName = http://www.myserver.com/path/data-file.txt
filename
- - Name of file to be opened, or null for stdin.enc
- - Encoding name, see Java encodings. Null implies default
value ISO-8859-1.
java.io.FileNotFoundException
- - If given file is not found.
java.io.UnsupportedEncodingException
- - If the encoding name is not recognised.
java.io.IOException
- - If there are problems when using URL'spublic static long getLineCount(java.lang.String fileName) throws java.io.IOException
fileName
- - the name (including path) of the file to check
java.lang.IllegalArgumentException
- - if the file name passed was null, the file was
not found, was not a normal file, was unable to
be read
java.io.IOException
- - if there was a problem reading the data from the file
when trying to determine the line countpublic static boolean fileExists(java.lang.String fileName)
fileName
- - the name of the file to check
public static boolean deleteFileFailSilently(java.lang.String fileName)
fileName
- the file to delete
public static void deleteFile(java.lang.String fileName) throws IbafException
fileName
- the file to delete
IbafException
- - if the file can't be written to or is a
directory or there was some sort of IO Error.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |