public class IOUtil extends Object
Modifier and Type | Field and Description |
---|---|
static String[] |
DEFAULT_EXCLUDES_SUFFIXES
comes from org.codehaus.plexus.util.DirectoryScanner
|
Constructor and Description |
---|
IOUtil() |
Modifier and Type | Method and Description |
---|---|
boolean |
contentEquals(File file1,
File file2) |
boolean |
contentEquals(Reader reader1,
Reader reader2) |
boolean |
contentEquals(String file1,
String file2) |
boolean |
fileExists(String filename) |
String |
fileToString(File file)
Write to a string the bytes read from a file
|
String |
fileToString(String fileName)
Write to a string the bytes read from a file
|
void |
forceDelete(File tempFile)
force the deletion of a file
|
void |
forceDelete(String filename)
force the deletion of a file
|
void |
forceMove(File from,
File to) |
String |
getTempFolder()
return the temp folder
|
void |
inputStreamToFile(InputStream is,
String filename)
Write to a file the bytes read from an input stream.
|
int |
inputStreamToOutputStream(InputStream is,
OutputStream os)
Write to the outputstream the bytes read from the input stream.
|
String |
inputStreamToString(InputStream is,
String charset)
Write to a string the bytes read from an input stream.
|
boolean |
isParentAnEmptyDirectory(File file)
Determine if the directory where the passed file resides is empty.
|
Collection<String> |
listFiles(File folder)
Recurse in the folder to get the list all files and folders of all non svn files
|
Collection<String> |
listFiles(File folder,
IOFileFilter ioFileFilter)
Recurse in the folder to get the list all files and folders
do not recurse in svn folder
do not recurse in cvs folder
do not match .bak files
do not match .old files
|
Collection<String> |
listFolders(File folder)
Recurse in the folder to get the list all files and folders of all non svn files
|
void |
mkdirs(File file)
given a file create the folder structure
|
void |
mkdirs(String filename)
given a file create the folder structure
|
void |
pruneEmptyDirs(File targetFile)
prune empty dir
|
void |
pruneEmptyDirs(String targetFile)
prune empty dir
|
void |
stringToFile(String content,
File file)
Save a string to a file.
|
void |
stringToFile(String content,
String filename)
Save a string to a file.
|
void |
stringToOutputStream(String content,
OutputStream out)
Save a string to a file.
|
public static final String[] DEFAULT_EXCLUDES_SUFFIXES
public int inputStreamToOutputStream(InputStream is, OutputStream os) throws IOException
IOException
public void stringToFile(String content, File file) throws IOException
content
- the string to be written to filefilen
- fhe file objectIOException
public void stringToFile(String content, String filename) throws IOException
content
- the string to be written to filefilename
- the full or relative path to the file.IOException
public void stringToOutputStream(String content, OutputStream out) throws IOException
content
- the string to be written to filefilename
- the full or relative path to the file.IOException
public void inputStreamToFile(InputStream is, String filename) throws IOException
filename
- the full or relative path to the file.IOException
public String fileToString(String fileName) throws IOException
fileName
- the file nameIOException
public String fileToString(File file) throws IOException
file
- the fileIOException
public String inputStreamToString(InputStream is, String charset) throws IOException
charset
- the charset used to read the input streamIOException
public boolean isParentAnEmptyDirectory(File file)
targetFile
- the folder to removepublic void pruneEmptyDirs(String targetFile)
targetFile
- the folder to removepublic void pruneEmptyDirs(File targetFile)
targetFile
- the folder to removepublic Collection<String> listFiles(File folder)
folder
- the folder to parsepublic Collection<String> listFiles(File folder, IOFileFilter ioFileFilter)
folder
- the folder to parseioFileFilter
- additionnal IOFilterpublic Collection<String> listFolders(File folder)
folder
- the folder to parsepublic String getTempFolder()
public void mkdirs(String filename)
public void mkdirs(File file)
public void forceDelete(String filename)
public void forceDelete(File tempFile)
public boolean fileExists(String filename)
Copyright © 2005-2013 JAXIO S.A.R.L. - All Rights Reserved.