public class IOUtil
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
FILE_ENCODING |
static java.lang.String |
TMP_DIRECTORY |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
addJarEntry(byte[] jarToUpdate,
java.lang.String entryName,
byte[] entryContent) |
static boolean |
checkMD5(java.io.File md5File,
byte[] contentToCheck) |
static boolean |
deleteDir(java.io.File dir) |
static boolean |
deleteDir(java.io.File dir,
int attempts,
long sleepTime) |
static boolean |
deleteFile(java.io.File file,
int attempts,
long sleepTime) |
static byte[] |
generateJar(java.lang.Class<?>... classes) |
static byte[] |
generateJar(java.util.Map<java.lang.String,byte[]> resources) |
static byte[] |
generateZip(java.util.Map<java.lang.String,byte[]> resources) |
static byte[] |
getAllContentFrom(java.io.File file)
Equivalent to
getAllContentFrom(new
FileInputStream(file)); |
static byte[] |
getAllContentFrom(java.io.InputStream in)
Return the whole underlying stream content into a single String.
|
static byte[] |
getAllContentFrom(java.net.URL url)
Return the whole underlying stream content into a single String.
|
static byte[] |
getBytes(java.util.zip.ZipInputStream zipInputstream) |
static java.util.List<java.lang.String> |
getClassNameList(byte[] jarContent) |
static byte[] |
getPropertyAsString(java.util.Properties prop,
java.lang.String comment) |
static java.util.Map<java.lang.String,byte[]> |
getResources(java.lang.Class<?>... classes) |
static byte[] |
getZipEntryContent(java.lang.String entryName,
byte[] zipFile) |
static byte[] |
getZipEntryContent(java.lang.String entryName,
java.io.InputStream inputStream) |
static java.lang.String |
md5(byte[] content) |
static java.lang.String |
read(java.io.File file)
Read the contents of the given file.
|
static java.lang.String |
read(java.io.InputStream inputStream)
Read the contents from the given FileInputStream.
|
static java.lang.String |
readResource(java.lang.String fileName) |
static byte[] |
toByteArray(org.w3c.dom.Document document) |
static java.util.Map<java.lang.String,byte[]> |
unzip(byte[] zipFile) |
static void |
updatePropertyValue(java.io.File propertiesFile,
java.util.Map<java.lang.String,java.lang.String> pairs) |
static void |
write(java.io.File file,
byte[] fileContent) |
static void |
writeFile(java.io.File file,
java.lang.String fileContent) |
static void |
writeMD5(java.io.File file,
byte[] bytes) |
static byte[] |
zip(java.util.Map<java.lang.String,byte[]> files) |
static byte[] |
zip(Pair<java.lang.String,byte[]>... files) |
public static final java.lang.String TMP_DIRECTORY
public static final java.lang.String FILE_ENCODING
public static java.util.List<java.lang.String> getClassNameList(byte[] jarContent)
throws java.io.IOException
java.io.IOExceptionpublic static void write(java.io.File file,
byte[] fileContent)
throws java.io.IOException
java.io.IOExceptionpublic static byte[] generateJar(java.lang.Class<?>... classes)
throws java.io.IOException
java.io.IOExceptionpublic static java.util.Map<java.lang.String,byte[]> getResources(java.lang.Class<?>... classes)
throws java.io.IOException
java.io.IOExceptionpublic static byte[] generateJar(java.util.Map<java.lang.String,byte[]> resources)
throws java.io.IOException
java.io.IOExceptionpublic static byte[] generateZip(java.util.Map<java.lang.String,byte[]> resources)
throws java.io.IOException
java.io.IOExceptionpublic static byte[] getAllContentFrom(java.io.InputStream in)
throws java.io.IOException
in - the stream to readjava.io.IOException - if an I/O exception occurspublic static java.lang.String read(java.io.InputStream inputStream)
inputStream - the stream to read frompublic static java.lang.String read(java.io.File file)
throws java.io.IOException
file - java.io.IOExceptionpublic static byte[] getAllContentFrom(java.io.File file)
throws java.io.IOException
getAllContentFrom(new
FileInputStream(file));file - the file to readjava.io.IOException - If an I/O exception occurspublic static byte[] getAllContentFrom(java.net.URL url)
throws java.io.IOException
url - the URL to readjava.io.IOException - if an I/O exception occurspublic static boolean deleteDir(java.io.File dir)
throws java.io.IOException
java.io.IOExceptionpublic static boolean deleteDir(java.io.File dir,
int attempts,
long sleepTime)
throws java.io.IOException
java.io.IOExceptionpublic static boolean deleteFile(java.io.File file,
int attempts,
long sleepTime)
public static void writeFile(java.io.File file,
java.lang.String fileContent)
throws java.io.IOException
java.io.IOExceptionpublic static byte[] zip(java.util.Map<java.lang.String,byte[]> files)
throws java.io.IOException
java.io.IOExceptionpublic static byte[] zip(Pair<java.lang.String,byte[]>... files) throws java.io.IOException
java.io.IOExceptionpublic static final java.util.Map<java.lang.String,byte[]> unzip(byte[] zipFile)
throws java.io.IOException
java.io.IOExceptionpublic static byte[] getZipEntryContent(java.lang.String entryName,
java.io.InputStream inputStream)
throws java.io.IOException
java.io.IOExceptionpublic static byte[] getBytes(java.util.zip.ZipInputStream zipInputstream)
throws java.io.IOException
java.io.IOExceptionpublic static byte[] getZipEntryContent(java.lang.String entryName,
byte[] zipFile)
throws java.io.IOException
java.io.IOExceptionpublic static byte[] toByteArray(org.w3c.dom.Document document)
throws java.io.IOException,
javax.xml.transform.TransformerException
java.io.IOExceptionjavax.xml.transform.TransformerExceptionpublic static byte[] addJarEntry(byte[] jarToUpdate,
java.lang.String entryName,
byte[] entryContent)
throws java.io.IOException
java.io.IOExceptionpublic static byte[] getPropertyAsString(java.util.Properties prop,
java.lang.String comment)
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String readResource(java.lang.String fileName)
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String md5(byte[] content)
throws java.security.NoSuchAlgorithmException
java.security.NoSuchAlgorithmExceptionpublic static void writeMD5(java.io.File file,
byte[] bytes)
throws java.security.NoSuchAlgorithmException,
java.io.IOException
java.security.NoSuchAlgorithmExceptionjava.io.IOExceptionpublic static boolean checkMD5(java.io.File md5File,
byte[] contentToCheck)
throws java.security.NoSuchAlgorithmException
java.security.NoSuchAlgorithmExceptionpublic static void updatePropertyValue(java.io.File propertiesFile,
java.util.Map<java.lang.String,java.lang.String> pairs)
throws java.io.IOException
java.io.IOException