public class IoUtils
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static void |
appendToFile(java.io.File source,
java.io.File destination,
long maxFileSize,
int maxBackupIndex) |
static void |
closeQuietly(java.io.Closeable closeable) |
static void |
closeQuietly(java.io.InputStream inputStream)
Needed for old JVMs where
InputStream does not implement Closeable. |
static void |
closeQuietly(java.net.URLConnection cnn) |
static void |
closeQuietly(java.io.Writer writer) |
static void |
copy(java.io.InputStream in,
java.io.OutputStream out) |
static org.w3c.dom.Document |
getFileAsDocument(Resource resource) |
static long |
getFileLastModificationDate(java.lang.String filePath) |
static boolean |
isFileUrl(java.net.URL url) |
static void |
replaceFile(java.io.File source,
java.io.File destination) |
static void |
rollFiles(java.io.File destination,
int maxBackupIndex) |
static boolean |
validateDestinationFile(java.io.File source,
java.io.File destination,
long maxFileSize,
int maxBackupIndex) |
protected static final Logger logger
public static long getFileLastModificationDate(@Nullable
java.lang.String filePath)
throws IoRuntimeException
filePath - can be prefixed by "http://", "https://", "file://". If given value is not prefixed, "file://" is assumed.long value representing the time the file was
last modified, measured in milliseconds since the epoch
(00:00:00 GMT, January 1, 1970), or 0L if the
file does not exist, if an I/O error occurs or if the given filePath is nullIoRuntimeException@Nonnull
public static org.w3c.dom.Document getFileAsDocument(@Nonnull
Resource resource)
throws IoRuntimeException
IoRuntimeExceptionpublic static boolean isFileUrl(java.net.URL url)
public static void closeQuietly(java.net.URLConnection cnn)
public static void closeQuietly(java.io.Closeable closeable)
public static void closeQuietly(java.io.Writer writer)
public static void closeQuietly(java.io.InputStream inputStream)
InputStream does not implement Closeable.public static void replaceFile(java.io.File source,
java.io.File destination)
throws java.io.IOException
java.io.IOExceptionpublic static void appendToFile(java.io.File source,
java.io.File destination,
long maxFileSize,
int maxBackupIndex)
throws java.io.IOException
java.io.IOExceptionpublic static boolean validateDestinationFile(java.io.File source,
java.io.File destination,
long maxFileSize,
int maxBackupIndex)
throws java.io.IOException
java.io.IOExceptionpublic static void rollFiles(java.io.File destination,
int maxBackupIndex)
throws java.io.IOException
java.io.IOExceptionpublic static void copy(java.io.InputStream in,
java.io.OutputStream out)
throws java.io.IOException
java.io.IOExceptionCopyright © 2018. All Rights Reserved.