|
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.erowid.sperowider.FileUtils
Simple file utilities.
Constructor Summary | |
FileUtils()
|
Method Summary | |
static boolean |
compare(File f1,
File f2)
Compares two files or directories and returns true if they both exist and they both have the same contents, or if neither exists. |
static boolean |
compare(InputStream is1,
InputStream is2)
Compares two IO streams and returns true if they match. |
static void |
copy(InputStream is,
OutputStream os)
Copies for an input stream to a file. |
static void |
copyDirectory(File fromDir,
File toDir)
Copies the contents of one directory, recursively, to another. |
static void |
copyFile(File source,
File destination)
Copies for an input stream to a file. |
static void |
copyFile(File source,
String destination)
Copies for an input stream to a file. |
static void |
copyFile(String source,
File destination)
Copies for an input stream to a file. |
static void |
copyFile(String source,
String destination)
Copies for an input stream to a file. |
static File |
createFile(File file)
Creates a file at a given location. |
static File |
createFile(String name)
Creates a file at a given location. |
static boolean |
deleteFilesRecursively(File repository)
Does a recursive delete on a directory |
static StringBuffer |
getFileContent(String fileName)
Pumps the contents of a file into a StringBuffer . |
static OutputStream |
getFileOutputStream(File file)
Gets an output stream for a given file name, creating the file if necessary. |
static OutputStream |
getFileOutputStream(String name)
Gets an output stream for a given file name, creating the file if necessary. |
static PrintWriter |
getFilePrintWriter(File file)
Gets an PrintWriter for a given file name, creating the file if necessary. |
static PrintWriter |
getFilePrintWriter(String name)
Gets an PrintWriter for a given file name, creating the file if necessary. |
static File |
gunzip(File source)
Gzips a file to a file of the same name, plus .gz. |
static void |
gunzip(File source,
File destination)
Gzips from one file to another. |
static void |
gunzip(File source,
String destination)
Gzips to a file. |
static void |
gunzip(InputStream is,
OutputStream os)
Gzips from the input stream to the output stream. |
static String |
gunzip(String source)
Gunzips a file to a file of the same name, minus .gz. |
static void |
gunzip(String source,
File destination)
Gzips to a file. |
static void |
gunzip(String source,
String destination)
Gzips to a file. |
static File |
gzip(File source)
Gzips a file to a file of the same name, plus .gz. |
static File |
gzip(File source,
File destination)
Gzips from one file to another. |
static File |
gzip(File source,
String destination)
Gzips to a file. |
static void |
gzip(InputStream is,
OutputStream os)
Gzips from the input stream to the output stream. |
static File |
gzip(String source)
Gzips a file to a file of the same name, plus .gz. |
static File |
gzip(String source,
File destination)
Gzips to a file. |
static File |
gzip(String source,
String destination)
Gzips to a file. |
static File[] |
split(File source,
int segmentSize)
Splits a file into multiple files, each equal to the passed in length, except for the last file, which will probably be smaller as it's what is left. |
static int |
split(InputStream is,
File file,
int length)
Copes length bytes from the InputStream to a file. |
static File[] |
split(String source,
int segmentSize)
Splits a file into multiple files, each equal to the passed in length, except for the last file, which will probably be smaller as it's what is left. |
static File[] |
splitAndCompress(File source,
int segmentSize)
Splits a file into pieces, and then gzips each piece. |
static File[] |
splitAndCompress(String source,
int segmentSize)
Splits a file into pieces, and then gzips each piece. |
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 boolean deleteFilesRecursively(File repository)
public static void copyDirectory(File fromDir, File toDir) throws IOException
IOException
public static PrintWriter getFilePrintWriter(File file) throws IOException
IOException
public static OutputStream getFileOutputStream(File file) throws IOException
IOException
public static PrintWriter getFilePrintWriter(String name) throws IOException
IOException
public static OutputStream getFileOutputStream(String name) throws IOException
IOException
public static File createFile(String name) throws IOException
IOException
public static File createFile(File file) throws IOException
IOException
public static File[] splitAndCompress(String source, int segmentSize) throws IOException
IOException
public static File[] splitAndCompress(File source, int segmentSize) throws IOException
IOException
public static File[] split(String source, int segmentSize) throws IOException
IOException
public static File[] split(File source, int segmentSize) throws IOException
IOException
public static int split(InputStream is, File file, int length) throws IOException
IOException
public static void copy(InputStream is, OutputStream os) throws IOException
IOException
public static void copyFile(String source, File destination) throws IOException
IOException
public static void copyFile(File source, String destination) throws IOException
IOException
public static void copyFile(String source, String destination) throws IOException
IOException
public static void copyFile(File source, File destination) throws IOException
IOException
public static StringBuffer getFileContent(String fileName) throws FileNotFoundException, IOException
StringBuffer
.
FileNotFoundException
IOException
public static File gzip(String source) throws IOException
IOException
public static File gzip(File source) throws IOException
IOException
public static File gzip(String source, String destination) throws IOException
IOException
public static File gzip(String source, File destination) throws IOException
IOException
public static File gzip(File source, String destination) throws IOException
IOException
public static File gzip(File source, File destination) throws IOException
IOException
public static void gzip(InputStream is, OutputStream os) throws IOException
IOException
public static String gunzip(String source) throws IOException
IOException
public static File gunzip(File source) throws IOException
IOException
public static void gunzip(String source, String destination) throws IOException
IOException
public static void gunzip(String source, File destination) throws IOException
IOException
public static void gunzip(File source, String destination) throws IOException
IOException
public static void gunzip(File source, File destination) throws IOException
IOException
public static void gunzip(InputStream is, OutputStream os) throws IOException
IOException
public static boolean compare(File f1, File f2) throws IOException
IOException
public static boolean compare(InputStream is1, InputStream is2) throws IOException
IOException
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |