|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.jaxfront.core.util.io.FileHelper
public class FileHelper
The FileHelper class defines a set of convenience methods for file handling!
| Field Summary | |
|---|---|
static java.lang.String |
ESCPAE_HTML
|
static java.lang.String |
PROTOCOL_FILE
|
| Constructor Summary | |
|---|---|
FileHelper()
Constructor of FileHelper |
|
FileHelper(java.io.File file)
Constructor of FileHelper |
|
FileHelper(java.io.File file,
boolean createDirs)
Constructor of FileHelper |
|
FileHelper(java.lang.String resourceURL)
Constructor of FileHelper |
|
FileHelper(java.lang.String resourceURL,
boolean createDirs)
|
|
FileHelper(java.net.URL resourceURL)
Constructor of FileHelper |
|
FileHelper(java.net.URL resourceURL,
boolean createDirs)
Constructor of FileHelper |
|
| Method Summary | |
|---|---|
void |
closeFileEntry()
Close all output streams of the FileHelper instance. |
static void |
closeStream(java.io.Closeable s)
|
static void |
copy(java.io.File source,
java.io.File destination)
Copy a file from source to destination |
static void |
copy(java.net.URL source,
java.io.File destination)
Copy a file from source to destination |
static void |
copy(java.net.URL source,
java.net.URL destination)
Copy a file from source to destination |
static void |
deleteDir(java.io.File[] file,
boolean deep)
|
static void |
deleteDir(java.io.File file,
boolean deep)
|
static boolean |
fileExist(java.io.File file)
check if a file exists. |
static boolean |
fileExist(java.lang.String file)
check if a file exists. |
static java.io.File |
getDirectory(java.io.File source)
|
static java.lang.String |
getDirectory(java.lang.String completeFile)
|
static java.lang.String |
getDirectory(java.lang.String completeFile,
boolean returnFileIfNone)
|
static java.io.File |
getDirectory(java.net.URL fileToOpen)
|
static java.lang.String |
getFileName(java.io.File completeFile)
|
static java.lang.String |
getFileName(java.lang.String fileName)
|
static java.lang.String |
getFileName(java.lang.String fileName,
boolean includeExt)
|
static java.lang.String |
getFileNameExtension(java.io.File file)
|
static java.lang.String |
getFileNameExtension(java.io.File file,
boolean includeDot)
|
static java.lang.String |
getFileNameExtension(java.lang.String fileName,
boolean includeDot)
|
static java.io.Reader |
getReader(org.w3c.dom.ls.LSInput xsdInput)
|
static boolean |
mkdirs(java.io.File file,
boolean includingLeaf)
Creates the directory named by this abstract pathname, including any necessary but nonexistent parent directories. |
void |
openFileEntry(java.net.URL filename)
Open a FileOutputStream for the given URL. |
void |
openFileEntry(java.net.URL filename,
boolean createDirs)
Open a FileOutputStream for the given URL. |
static int[] |
parseLines(byte[] seekbuffer,
int rows,
java.lang.StringBuffer sb)
|
static byte[] |
read(java.io.InputStream in)
Reads a file and returns the content as bytearray. |
static byte[] |
read(java.io.Reader in)
|
static java.lang.String |
readAsString(java.io.InputStream in,
java.lang.String encoding)
Reads a file and returns the content as String. |
static java.lang.String |
readAsString(java.io.Reader in)
|
static java.lang.String[][] |
readDelimFile(java.net.URL fileUrl,
java.lang.String delim)
|
static byte[] |
readFile(java.io.File file)
Reads a file and returns the content as bytearray. |
static byte[] |
readFile(java.lang.String filename)
Reads a file and returns the content as bytearray. |
static byte[] |
readFile(java.net.URL fileUrl)
Reads a file and returns the content as bytearray. |
static java.lang.String |
readFileAsString(java.io.File file)
|
static java.lang.String |
readFileAsString(org.w3c.dom.ls.LSInput xsdInput)
|
static java.lang.String |
readFileAsString(org.w3c.dom.ls.LSInput xsdInput,
int bufferLen)
|
static java.lang.String |
readFileAsString(java.net.URL fileUrl)
|
static java.lang.String |
readFileAsString(java.net.URL fileUrl,
java.lang.String encoding)
Reads a file and returns the content as String. |
static java.lang.String |
removeFileNameExtension(java.lang.String fileName)
|
static java.lang.String |
replaceFileExtension(java.lang.String fileName,
java.lang.String extension)
|
static java.lang.String |
replaceFileName(java.lang.String file,
java.lang.String newName)
|
static void |
save(java.lang.Object myObject,
java.lang.String filename)
Save a Java object into a file using java.io.ObjectOutputStream. |
static void |
save(java.lang.StringBuffer buffer,
java.io.File file,
java.lang.String encoding)
|
static void |
save(java.lang.String buffer,
java.io.File file,
java.lang.String encoding)
|
static java.lang.String |
tail(java.lang.String fileName,
int lineCount)
|
static void |
tail(java.lang.String fileName,
int lineCount,
int bufferSize,
java.io.Writer pw,
java.lang.String escapeAs)
|
static void |
tail(java.lang.String fileName,
int lineCount,
java.io.PrintWriter writer,
java.lang.String escapeAs)
|
static java.lang.StringBuffer |
tailLines(int rows,
java.lang.StringBuffer seekString)
|
static java.io.OutputStream |
write(java.io.InputStream inStream,
java.io.OutputStream outstream)
|
static java.io.OutputStream |
write(java.io.InputStream inStream,
java.io.OutputStream outstream,
java.lang.String srcEncoding)
|
static java.io.OutputStream |
write(java.io.Reader inReader,
java.io.OutputStream outwriter)
|
static java.io.Writer |
write(java.io.Reader inReader,
java.io.Writer outwriter)
|
static void |
write(java.lang.String buffer,
java.io.Writer writer)
|
FileHelper |
writeIntoFile(byte[] in)
Write's the byte sequence into the opened outputstream. |
FileHelper |
writeIntoFile(char[] in)
Write's the char sequence into the opened outputstream. |
FileHelper |
writeIntoFile(java.io.InputStream in)
Streams the InputStream into the opened outputstream. |
FileHelper |
writeIntoFile(java.io.Reader in)
Streams the Reader into the opened outputstream. |
FileHelper |
writeIntoFile(java.lang.String in)
Write's the String into the opened outputstream. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String ESCPAE_HTML
public static final java.lang.String PROTOCOL_FILE
| Constructor Detail |
|---|
public FileHelper()
throws java.io.FileNotFoundException
java.io.FileNotFoundException
public FileHelper(java.io.File file)
throws java.io.FileNotFoundException,
java.net.MalformedURLException
file -
java.io.FileNotFoundException
java.net.MalformedURLException
public FileHelper(java.io.File file,
boolean createDirs)
throws java.io.FileNotFoundException,
java.net.MalformedURLException
file -
java.io.FileNotFoundException
java.net.MalformedURLException
public FileHelper(java.lang.String resourceURL)
throws java.io.FileNotFoundException,
java.net.MalformedURLException
resourceURL -
java.io.FileNotFoundException
java.net.MalformedURLException
public FileHelper(java.lang.String resourceURL,
boolean createDirs)
throws java.io.FileNotFoundException,
java.net.MalformedURLException
java.io.FileNotFoundException
java.net.MalformedURLException
public FileHelper(java.net.URL resourceURL)
throws java.io.FileNotFoundException
resourceURL -
java.io.FileNotFoundException
public FileHelper(java.net.URL resourceURL,
boolean createDirs)
throws java.io.FileNotFoundException
resourceURL -
java.io.FileNotFoundException| Method Detail |
|---|
public void closeFileEntry()
throws java.io.IOException
java.io.IOExceptionpublic static void closeStream(java.io.Closeable s)
public static void copy(java.io.File source,
java.io.File destination)
throws java.io.IOException
source - java.net.URLdestination - java.net.URL
java.io.IOException
public static void copy(java.net.URL source,
java.io.File destination)
throws java.io.IOException
source - java.net.URLdestination - java.net.URL
java.io.IOException
public static void copy(java.net.URL source,
java.net.URL destination)
throws java.io.IOException
source - java.net.URLdestination - java.net.URL
java.io.IOException
public static void deleteDir(java.io.File[] file,
boolean deep)
public static void deleteDir(java.io.File file,
boolean deep)
public static boolean fileExist(java.io.File file)
file -
public static boolean fileExist(java.lang.String file)
file -
public static java.io.File getDirectory(java.io.File source)
public static java.lang.String getDirectory(java.lang.String completeFile)
public static java.lang.String getDirectory(java.lang.String completeFile,
boolean returnFileIfNone)
public static java.io.File getDirectory(java.net.URL fileToOpen)
public static java.lang.String getFileName(java.io.File completeFile)
public static java.lang.String getFileName(java.lang.String fileName)
public static java.lang.String getFileName(java.lang.String fileName,
boolean includeExt)
public static java.lang.String getFileNameExtension(java.io.File file)
public static java.lang.String getFileNameExtension(java.io.File file,
boolean includeDot)
public static java.lang.String getFileNameExtension(java.lang.String fileName,
boolean includeDot)
public static java.io.Reader getReader(org.w3c.dom.ls.LSInput xsdInput)
throws java.io.IOException
java.io.IOException
public static boolean mkdirs(java.io.File file,
boolean includingLeaf)
true if and only if the directory was created, along with all necessary parent directories; false otherwise
java.lang.SecurityException - If a security manager exists and its SecurityManager.checkWrite(java.lang.String) method does not permit
the named directory and all necessary parent directories and to be created
public void openFileEntry(java.net.URL filename)
throws java.io.FileNotFoundException
filename -
java.io.FileNotFoundException
public void openFileEntry(java.net.URL filename,
boolean createDirs)
throws java.io.FileNotFoundException
filename -
java.io.FileNotFoundException
public static int[] parseLines(byte[] seekbuffer,
int rows,
java.lang.StringBuffer sb)
throws java.io.IOException
java.io.IOException
public static byte[] read(java.io.InputStream in)
throws java.io.IOException
fileUrl -
java.io.IOException
public static byte[] read(java.io.Reader in)
throws java.io.IOException
java.io.IOException
public static java.lang.String readAsString(java.io.InputStream in,
java.lang.String encoding)
throws java.io.IOException
fileUrl -
java.io.IOException
public static java.lang.String readAsString(java.io.Reader in)
throws java.io.IOException
java.io.IOException
public static java.lang.String[][] readDelimFile(java.net.URL fileUrl,
java.lang.String delim)
throws java.io.IOException
java.io.IOException
public static byte[] readFile(java.io.File file)
throws java.io.IOException
file -
java.io.IOException
public static byte[] readFile(java.lang.String filename)
throws java.io.IOException
filename -
java.io.IOException
public static byte[] readFile(java.net.URL fileUrl)
throws java.io.IOException
fileUrl -
java.io.IOException
public static java.lang.String readFileAsString(java.io.File file)
throws java.io.IOException
java.io.IOException
public static java.lang.String readFileAsString(org.w3c.dom.ls.LSInput xsdInput)
throws java.io.IOException
java.io.IOException
public static java.lang.String readFileAsString(org.w3c.dom.ls.LSInput xsdInput,
int bufferLen)
throws java.io.IOException
java.io.IOException
public static java.lang.String readFileAsString(java.net.URL fileUrl)
throws java.io.IOException
java.io.IOException
public static java.lang.String readFileAsString(java.net.URL fileUrl,
java.lang.String encoding)
throws java.io.IOException
fileUrl -
java.io.IOExceptionpublic static java.lang.String removeFileNameExtension(java.lang.String fileName)
public static java.lang.String replaceFileExtension(java.lang.String fileName,
java.lang.String extension)
public static java.lang.String replaceFileName(java.lang.String file,
java.lang.String newName)
public static void save(java.lang.Object myObject,
java.lang.String filename)
myObject - filename - ObjectOutputStream
public static void save(java.lang.StringBuffer buffer,
java.io.File file,
java.lang.String encoding)
throws java.io.IOException
java.io.IOException
public static void save(java.lang.String buffer,
java.io.File file,
java.lang.String encoding)
throws java.io.IOException
java.io.IOException
public static java.lang.String tail(java.lang.String fileName,
int lineCount)
public static void tail(java.lang.String fileName,
int lineCount,
int bufferSize,
java.io.Writer pw,
java.lang.String escapeAs)
throws java.io.IOException
java.io.IOException
public static void tail(java.lang.String fileName,
int lineCount,
java.io.PrintWriter writer,
java.lang.String escapeAs)
public static java.lang.StringBuffer tailLines(int rows,
java.lang.StringBuffer seekString)
throws java.io.IOException
java.io.IOException
public static java.io.OutputStream write(java.io.InputStream inStream,
java.io.OutputStream outstream)
throws java.io.IOException
java.io.IOException
public static java.io.OutputStream write(java.io.InputStream inStream,
java.io.OutputStream outstream,
java.lang.String srcEncoding)
throws java.io.IOException
java.io.IOException
public static java.io.OutputStream write(java.io.Reader inReader,
java.io.OutputStream outwriter)
throws java.io.IOException
java.io.IOException
public static java.io.Writer write(java.io.Reader inReader,
java.io.Writer outwriter)
throws java.io.IOException
java.io.IOException
public static void write(java.lang.String buffer,
java.io.Writer writer)
throws java.io.IOException
java.io.IOException
public FileHelper writeIntoFile(byte[] in)
throws java.io.IOException
in -
java.io.IOException
public FileHelper writeIntoFile(char[] in)
throws java.io.IOException
in -
java.io.IOException
public FileHelper writeIntoFile(java.io.InputStream in)
throws java.io.IOException
in -
java.io.IOException
public FileHelper writeIntoFile(java.io.Reader in)
throws java.io.IOException
in -
java.io.IOException
public FileHelper writeIntoFile(java.lang.String in)
throws java.io.IOException
in -
java.io.IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||