|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.googlecode.flyway.core.util.ResourceUtils
public class ResourceUtils
Utility class for dealing with classpath resources.
| Method Summary | |
|---|---|
static long |
checksum(java.lang.String location)
Computes the checksum of a classpath resource using. |
static java.util.zip.Checksum |
checksum(java.lang.String location,
java.util.zip.Checksum checksum)
Computes the checksum of a classpath resource using the specified checksum object. |
static void |
closeQuietly(java.io.InputStream input)
Unconditionally close an InputStream. |
static long |
copyLarge(java.io.InputStream input,
java.io.OutputStream output)
Copy bytes from a large (over 2GB) InputStream to an
OutputStream. |
static java.lang.String |
loadResourceAsString(org.springframework.core.io.Resource resource,
java.lang.String encoding)
Loads this resource in a string using this encoding. |
static java.lang.String |
loadResourceAsString(java.lang.String location)
Loads the resource at this location within the classpath in a string using UTF-8 encoding. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static java.lang.String loadResourceAsString(java.lang.String location)
location - The location of the resource on the classpath.
public static java.lang.String loadResourceAsString(org.springframework.core.io.Resource resource,
java.lang.String encoding)
resource - The resource to load.encoding - The encoding of the resource.
public static long checksum(java.lang.String location)
throws java.io.IOException
location - The location of the resource on the classpath.
java.io.IOException - if an IO error occurs reading the resource
public static java.util.zip.Checksum checksum(java.lang.String location,
java.util.zip.Checksum checksum)
throws java.io.IOException
location - The location of the resource on the classpath.checksum - the checksum object to be used, must not be null
java.io.IOException - if an IO error occurs reading the resource
public static long copyLarge(java.io.InputStream input,
java.io.OutputStream output)
throws java.io.IOException
InputStream to an
OutputStream.
This method buffers the input internally, so there is no need to use a
BufferedInputStream.
input - the InputStream to read fromoutput - the OutputStream to write to
java.lang.NullPointerException - if the input or output is null
java.io.IOException - if an I/O error occurspublic static void closeQuietly(java.io.InputStream input)
InputStream.
Equivalent to InputStream.close(), except any exceptions will be ignored.
This is typically used in finally blocks.
input - the InputStream to close, may be null or already closed
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||