public final class FileUtils extends Object
Modifier and Type | Field and Description |
---|---|
static int |
ZERO_COPY_CHUNK_SIZE |
Modifier and Type | Method and Description |
---|---|
static void |
close(InputStream stream) |
static void |
close(OutputStream stream) |
static void |
close(RandomAccessFile accessFile) |
static void |
close(Reader stream) |
static void |
close(Writer stream) |
static void |
computeGlobalHash(FilesystemBasedDigest digest,
File file,
int length)
Compute global hash (if possible) from a file but up to length
|
static File[] |
copy(File[] from,
File directoryTo,
boolean move)
Copy a group of files to a directory (will ignore directories)
|
static void |
copy(File from,
File to,
boolean move,
boolean append)
Copy one file to another one
|
static long |
copy(InputStream from,
OutputStream to)
From Google Guava copy within ByteStreams
Copies all bytes from the input stream to the output stream.
|
static void |
copy(int blockSize,
InputStream inputStream,
OutputStream out)
Helper method to write from InputStream to OutputStream,
closing streams
|
static File[] |
copyRecursive(File from,
File directoryTo,
boolean move)
Copy from a directory to a directory with recursivity
|
static boolean |
createDir(File directory)
Create the directory associated with the File as path
|
static boolean |
delete(File file)
Delete physically the file
|
static boolean |
deleteDir(File directory)
Delete the directory associated with the File as path if empty
|
static boolean |
deleteRecursiveDir(File directory)
Delete the directory and its subdirs associated with the File as path if
empty
|
static boolean |
fileExist(String fileName,
String path) |
static boolean |
forceDeleteRecursiveDir(File directory)
Delete all its subdirs and files associated, not itself
|
static File[] |
getFiles(File directory)
Get the list of files from a given directory
|
static File[] |
getFiles(File directory,
FilenameFilter filter)
Get the list of files from a given directory and a filter
|
static boolean |
isInSubdirectory(File dir,
File file)
Check if the file (directory or file) is in directory dir or in sub
directories of dir
|
static long |
uncompressedBz2File(File fileIn,
File fileOut)
Read one compressed file and return the associated BufferedReader
|
public static final int ZERO_COPY_CHUNK_SIZE
public static void close(Reader stream)
public static void close(Writer stream)
public static void close(InputStream stream)
public static void close(OutputStream stream)
public static void close(RandomAccessFile accessFile)
public static boolean deleteDir(File directory)
directory
- public static boolean delete(File file)
file
- public static File[] copyRecursive(File from, File directoryTo, boolean move) throws Reply550Exception
from
- directoryTo
- move
- True if the copy is in fact a move operationReply550Exception
public static File[] copy(File[] from, File directoryTo, boolean move) throws Reply550Exception
from
- directoryTo
- move
- True if the copy is in fact a move operationReply550Exception
public static boolean createDir(File directory)
directory
- public static void copy(File from, File to, boolean move, boolean append) throws Reply550Exception
from
- to
- move
- True if the copy is in fact a move operationappend
- True if the copy is in appendReply550Exception
public static boolean forceDeleteRecursiveDir(File directory)
directory
- public static boolean deleteRecursiveDir(File directory)
directory
- public static boolean fileExist(String fileName, String path)
fileName
- path
- public static File[] getFiles(File directory)
directory
- public static void computeGlobalHash(FilesystemBasedDigest digest, File file, int length)
digest
- file
- length
- public static File[] getFiles(File directory, FilenameFilter filter)
directory
- filter
- public static long uncompressedBz2File(File fileIn, File fileOut)
fileIn
- fileOut
- public static long copy(InputStream from, OutputStream to) throws IOException
from
- the input stream to read fromto
- the output stream to write toIOException
- if an I/O error occurspublic static void copy(int blockSize, InputStream inputStream, OutputStream out) throws IOException
blockSize
- inputStream
- out
- IOException
Copyright © 2009–2022 Waarp. All rights reserved.