public class IoUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
appendToFile(File source,
File destination,
long maxFileSize,
int maxBackupIndex) |
static void |
closeQuietly(Closeable closeable) |
static void |
closeQuietly(InputStream inputStream)
Needed for old JVMs where
InputStream does not implement Closeable. |
static void |
closeQuietly(URLConnection cnn) |
static void |
closeQuietly(Writer writer) |
static void |
copy(InputStream in,
OutputStream out) |
static Document |
getFileAsDocument(Resource resource) |
static long |
getFileLastModificationDate(String filePath) |
static boolean |
isFileUrl(URL url) |
static void |
replaceFile(File source,
File destination) |
static void |
rollFiles(File destination,
int maxBackupIndex) |
static boolean |
validateDestinationFile(File source,
File destination,
long maxFileSize,
int maxBackupIndex) |
protected static final Logger logger
public static long getFileLastModificationDate(@Nullable 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 Document getFileAsDocument(@Nonnull Resource resource) throws IoRuntimeException
IoRuntimeExceptionpublic static boolean isFileUrl(URL url)
public static void closeQuietly(URLConnection cnn)
public static void closeQuietly(Closeable closeable)
public static void closeQuietly(Writer writer)
public static void closeQuietly(InputStream inputStream)
InputStream does not implement Closeable.public static void replaceFile(File source, File destination) throws IOException
IOExceptionpublic static void appendToFile(File source, File destination, long maxFileSize, int maxBackupIndex) throws IOException
IOExceptionpublic static boolean validateDestinationFile(File source, File destination, long maxFileSize, int maxBackupIndex) throws IOException
IOExceptionpublic static void rollFiles(File destination, int maxBackupIndex) throws IOException
IOExceptionpublic static void copy(InputStream in, OutputStream out) throws IOException
IOExceptionCopyright © 2017. All Rights Reserved.