public final class FileUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static boolean |
caseInsensitive |
| Constructor and Description |
|---|
FileUtil() |
| Modifier and Type | Method and Description |
|---|---|
static File |
createTempFile(InputStream in)
Create a temp file.
|
static File |
getCanonicalFile(File f) |
static String |
getCanonicalPath(File f) |
static String |
getCanonicalPath(String path) |
static String |
getExceptionMessage(Exception ex) |
static String |
getExceptionMessage(Exception ex,
boolean stackDump) |
static int |
isSubdirectoryOf(File pathFile,
List directories)
check whether the provided path is a subdirectory of the list of directories and vice versa.
|
static int |
isSubdirectoryOf(String directory,
VirtualFile[] directories)
check whether the provided directory is a subdirectory of the list of directories.
|
static File |
openFile(File parentPath,
String fileName)
Return an instance of File...
|
static File |
openFile(String path)
Return an instance of File...
|
static File |
openFile(String path,
boolean mkdir) |
static InputStream |
openStream(File file)
Return an input stream with BOM consumed...
|
static InputStream |
openStream(InputStream in)
Return an input stream with BOM consumed...
|
static InputStream |
openStream(String path)
Return an input stream with BOM consumed...
|
static byte[] |
readBytes(String f,
int line) |
static String |
readFile(File f) |
static String |
readLine(String f,
int line) |
static void |
streamOutput(InputStream in,
OutputStream out) |
static void |
writeBinaryFile(File file,
InputStream in)
Write a stream of binary data to a file.
|
static void |
writeBinaryFile(String fileName,
byte[] output) |
static void |
writeFile(String fileName,
String output)
Write a String to a file
|
public static File openFile(String path)
path - public static File openFile(File parentPath, String fileName)
parentPath - fileName - public static File createTempFile(InputStream in) throws IOException
in - IOExceptionpublic static InputStream openStream(File file) throws FileNotFoundException, IOException
file - FileNotFoundExceptionIOExceptionpublic static InputStream openStream(String path) throws FileNotFoundException, IOException
path - FileNotFoundExceptionIOExceptionpublic static InputStream openStream(InputStream in) throws IOException
in - IOExceptionpublic static void writeBinaryFile(File file, InputStream in) throws IOException
file - in - IOExceptionpublic static void streamOutput(InputStream in, OutputStream out) throws IOException
IOExceptionpublic static void writeFile(String fileName, String output) throws FileNotFoundException, IOException
fileName - output - IOExceptionFileNotFoundExceptionpublic static void writeBinaryFile(String fileName, byte[] output) throws FileNotFoundException, IOException
FileNotFoundExceptionIOExceptionpublic static byte[] readBytes(String f, int line)
public static int isSubdirectoryOf(File pathFile, List directories)
path - directories - public static int isSubdirectoryOf(String directory, VirtualFile[] directories)
directory - directories - Copyright © 2016 The Apache Software Foundation. All rights reserved.