Package com.arcadedb.utility
Class FileUtils
- java.lang.Object
-
- com.arcadedb.utility.FileUtils
-
public class FileUtils extends Object
-
-
Constructor Summary
Constructors Constructor Description FileUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
checkValidName(String iFileName)
static void
copyDirectory(File source, File destination)
static void
copyFile(File source, File destination)
static boolean
deleteFile(File file)
static void
deleteFolderIfEmpty(File dir)
static void
deleteRecursively(File rootFile)
static String
encode(String value, String encoding)
static String
escapeHTML(String s)
static long
getSizeAsNumber(Object iSize)
static String
getSizeAsString(long iSize)
static String
getStringContent(Object iValue)
static void
gzipFile(File sourceFile, File destFile)
static boolean
isLong(String iText)
static String
printWithLineNumbers(String text)
static String
readFileAsString(File file, String iCharset)
static Binary
readStreamAsBinary(InputStream iStream)
static String
readStreamAsString(InputStream iStream, String iCharset)
static String
readStreamAsString(InputStream iStream, String iCharset, long limit)
static boolean
renameFile(File from, File to)
static Number
string2number(String iText)
static String
threadDump()
static void
writeContentToStream(File file, byte[] content)
static void
writeContentToStream(OutputStream output, String iContent)
static void
writeFile(File iFile, String iContent)
-
-
-
Field Detail
-
KILOBYTE
public static final int KILOBYTE
- See Also:
- Constant Field Values
-
MEGABYTE
public static final int MEGABYTE
- See Also:
- Constant Field Values
-
GIGABYTE
public static final int GIGABYTE
- See Also:
- Constant Field Values
-
TERABYTE
public static final long TERABYTE
- See Also:
- Constant Field Values
-
UTF8_BOM
public static final String UTF8_BOM
- See Also:
- Constant Field Values
-
-
Method Detail
-
isLong
public static boolean isLong(String iText)
-
getSizeAsNumber
public static long getSizeAsNumber(Object iSize)
-
getSizeAsString
public static String getSizeAsString(long iSize)
-
checkValidName
public static void checkValidName(String iFileName) throws IOException
- Throws:
IOException
-
deleteRecursively
public static void deleteRecursively(File rootFile)
-
deleteFolderIfEmpty
public static void deleteFolderIfEmpty(File dir)
-
deleteFile
public static boolean deleteFile(File file)
-
copyFile
public static final void copyFile(File source, File destination) throws IOException
- Throws:
IOException
-
copyDirectory
public static final void copyDirectory(File source, File destination) throws IOException
- Throws:
IOException
-
renameFile
public static boolean renameFile(File from, File to) throws IOException
- Throws:
IOException
-
threadDump
public static String threadDump()
-
readFileAsString
public static String readFileAsString(File file, String iCharset) throws IOException
- Throws:
IOException
-
readStreamAsBinary
public static Binary readStreamAsBinary(InputStream iStream) throws IOException
- Throws:
IOException
-
readStreamAsString
public static String readStreamAsString(InputStream iStream, String iCharset) throws IOException
- Throws:
IOException
-
readStreamAsString
public static String readStreamAsString(InputStream iStream, String iCharset, long limit) throws IOException
- Throws:
IOException
-
writeFile
public static void writeFile(File iFile, String iContent) throws IOException
- Throws:
IOException
-
writeContentToStream
public static void writeContentToStream(File file, byte[] content) throws IOException
- Throws:
IOException
-
writeContentToStream
public static void writeContentToStream(OutputStream output, String iContent) throws IOException
- Throws:
IOException
-
gzipFile
public static void gzipFile(File sourceFile, File destFile) throws IOException
- Throws:
IOException
-
-