public class SpringIOUtils extends Object
>Mainly for use within the framework, but also useful for application code.
| Modifier and Type | Field and Description |
|---|---|
static int |
BUFFER_SIZE |
| Constructor and Description |
|---|
SpringIOUtils() |
| Modifier and Type | Method and Description |
|---|---|
static Object[] |
addAll(Object[] array1,
Object[] array2)
Adds the contents of 1 array to another.
|
static String |
byteArrayToHexString(byte[] in)
Convert a byte[] array to readable string format.
|
static void |
closeQuietly(Closeable closeable)
Closes a closeable gracefully without throwing exceptions etc.
|
static String |
computeChecksum(File f,
String algorithm) |
static void |
copy(byte[] in,
File out)
Copy the contents of the given byte array to the given output File.
|
static void |
copy(byte[] in,
OutputStream out)
Copy the contents of the given byte array to the given OutputStream.
|
static int |
copy(File in,
File out)
Copy the contents of the given input File to the given output File.
|
static int |
copy(InputStream in,
OutputStream out)
Copy the contents of the given InputStream to the given OutputStream.
|
static int |
copy(Reader in,
Writer out)
Copy the contents of the given Reader to the given Writer.
|
static int |
copy(Resource in,
File out)
Copy the contents of the given input File to the given output File.
|
static void |
copy(String in,
Writer out)
Copy the contents of the given String to the given output Writer.
|
static void |
copyAll(Resource base,
Resource[] resources,
File targetDir)
Copies all the resources for the given target directory.
|
static byte[] |
copyToByteArray(File in)
Copy the contents of the given input File into a new byte array.
|
static byte[] |
copyToByteArray(InputStream in)
Copy the contents of the given InputStream into a new byte array.
|
static String |
copyToString(Reader in)
Copy the contents of the given Reader into a String.
|
static groovy.util.XmlSlurper |
createXmlSlurper() |
static SAXParser |
newSAXParser() |
public static final int BUFFER_SIZE
public static String byteArrayToHexString(byte[] in)
in - byte[] buffer to convert to string formatpublic static String computeChecksum(File f, String algorithm) throws IOException
f - The filealgorithm - The algorithmIOException - if there is an errorpublic static Object[] addAll(Object[] array1, Object[] array2)
array1 - The target arrayarray2 - The source arraypublic static void copyAll(Resource base, Resource[] resources, File targetDir) throws IOException
base - The base resourceresources - The resources to copytargetDir - The target directoryIOException - if there is an errorpublic static int copy(File in, File out) throws IOException
in - the file to copy fromout - the file to copy toIOException - in case of I/O errorspublic static int copy(Resource in, File out) throws IOException
in - the file to copy fromout - the file to copy toIOException - in case of I/O errorspublic static void copy(byte[] in,
File out)
throws IOException
in - the byte array to copy fromout - the file to copy toIOException - in case of I/O errorspublic static byte[] copyToByteArray(File in) throws IOException
in - the file to copy fromIOException - in case of I/O errorspublic static int copy(InputStream in, OutputStream out) throws IOException
in - the stream to copy fromout - the stream to copy toIOException - in case of I/O errorspublic static void copy(byte[] in,
OutputStream out)
throws IOException
in - the byte array to copy fromout - the OutputStream to copy toIOException - in case of I/O errorspublic static byte[] copyToByteArray(InputStream in) throws IOException
in - the stream to copy fromIOException - in case of I/O errorspublic static int copy(Reader in, Writer out) throws IOException
in - the Reader to copy fromout - the Writer to copy toIOException - in case of I/O errorspublic static void copy(String in, Writer out) throws IOException
in - the String to copy fromout - the Writer to copy toIOException - in case of I/O errorspublic static void closeQuietly(Closeable closeable)
closeable - The closeablepublic static String copyToString(Reader in) throws IOException
in - the reader to copy fromIOException - in case of I/O errorspublic static groovy.util.XmlSlurper createXmlSlurper()
throws ParserConfigurationException,
SAXException
ParserConfigurationException - If there is a parser errorSAXException - If there is an error with SAXOpublic static SAXParser newSAXParser() throws ParserConfigurationException, SAXException
SAXParserParserConfigurationException - If there is a parser errorSAXException - If there is an error with SAXO