public class FileUtils
extends java.lang.Object
| Constructor and Description |
|---|
FileUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
appendUtf8(java.io.File file,
java.lang.CharSequence text) |
static void |
copyFile(java.io.File from,
java.io.File to)
Copies a file to another location.
|
static void |
copyFile(java.lang.String fromFilename,
java.lang.String toFilename)
Copies a file to another location.
|
static void |
deleteDirRecursive(java.io.File dir)
Deletes all files within the given directory recursively (including subdirectories).
|
static boolean |
deleteDirRecursiveBestEffort(java.io.File dir)
Deletes all files within the given directory recursively (including subdirectories).
|
static java.lang.String |
getMd5(java.io.File file) |
static java.lang.String |
getSha1(java.io.File file) |
static java.lang.String |
getSha256(java.io.File file) |
static byte[] |
readBytes(java.io.File file) |
static java.lang.String |
readChars(java.io.File file,
java.lang.String charset) |
static <T> T |
readObject(java.io.File file)
To read an object in a quick & dirty way.
|
static java.lang.String |
readUtf8(java.io.File file) |
static void |
updateChecksum(java.io.File file,
java.util.zip.Checksum checksum) |
static void |
writeBytes(java.io.File file,
byte[] content) |
static void |
writeChars(java.io.File file,
java.lang.String charset,
java.lang.CharSequence text,
boolean apppend) |
static void |
writeObject(java.io.File file,
java.lang.Object object)
To store an object in a quick & dirty way.
|
static void |
writeUtf8(java.io.File file,
java.lang.CharSequence text) |
public static byte[] readBytes(java.io.File file)
throws java.io.IOException
java.io.IOExceptionpublic static void writeBytes(java.io.File file,
byte[] content)
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String readUtf8(java.io.File file)
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String readChars(java.io.File file,
java.lang.String charset)
throws java.io.IOException
java.io.IOExceptionpublic static void writeUtf8(java.io.File file,
java.lang.CharSequence text)
throws java.io.IOException
java.io.IOExceptionpublic static void appendUtf8(java.io.File file,
java.lang.CharSequence text)
throws java.io.IOException
java.io.IOExceptionpublic static void writeChars(java.io.File file,
java.lang.String charset,
java.lang.CharSequence text,
boolean apppend)
throws java.io.IOException
java.io.IOExceptionpublic static void copyFile(java.io.File from,
java.io.File to)
throws java.io.IOException
java.io.IOExceptionpublic static void copyFile(java.lang.String fromFilename,
java.lang.String toFilename)
throws java.io.IOException
java.io.IOExceptionpublic static <T> T readObject(java.io.File file)
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOExceptionjava.lang.ClassNotFoundExceptionpublic static void writeObject(java.io.File file,
java.lang.Object object)
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String getMd5(java.io.File file)
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String getSha1(java.io.File file)
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String getSha256(java.io.File file)
throws java.io.IOException
java.io.IOExceptionpublic static void updateChecksum(java.io.File file,
java.util.zip.Checksum checksum)
throws java.io.IOException
java.io.IOExceptionpublic static void deleteDirRecursive(java.io.File dir)
throws java.io.IOException
java.io.IOExceptionpublic static boolean deleteDirRecursiveBestEffort(java.io.File dir)
Available under the Apache License, Version 2.0 - Copyright © 2012-2020 greenrobot.org. All Rights Reserved.