public final class IOHelper extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
IOHelper.HardLinkStrategy |
static interface |
IOHelper.SyncStrategy |
| Modifier and Type | Field and Description |
|---|---|
protected static int |
MAX_DIR_NAME_LENGTH |
protected static int |
MAX_FILE_NAME_LENGTH |
| Modifier and Type | Method and Description |
|---|---|
static void |
close(InputStream in) |
static void |
close(OutputStream out) |
static void |
close(Writer out) |
static void |
copyFile(File src,
File dest) |
static void |
copyInputStream(InputStream in,
OutputStream out) |
static boolean |
deleteChildren(File parent) |
static boolean |
deleteFile(File fileToDelete) |
static CLibrary |
getCLibrary() |
static String |
getDefaultDataDirectory() |
static String |
getDefaultDirectoryPrefix()
Allows a system property to be used to overload the default data
directory which can be useful for forcing the test cases to use a target/
prefix
|
static String |
getDefaultStoreDirectory() |
static Kernel32Library |
getKernel32Library() |
static void |
hardlink(File source,
File target) |
static void |
mkdirs(File dir) |
static void |
moveFile(File src,
File targetDirectory) |
static byte[] |
readBytes(File path) |
static byte[] |
readBytes(InputStream in) |
static String |
readText(File path) |
static String |
readText(File path,
String encoding) |
static String |
readText(InputStream in) |
static String |
readText(InputStream in,
String encoding) |
static void |
sync(FileDescriptor fd) |
static String |
toFileSystemDirectorySafeName(String name)
Converts any string into a string that is safe to use as a file name.
|
static String |
toFileSystemSafeName(String name) |
static String |
toFileSystemSafeName(String name,
boolean dirSeparators,
int maxFileLength)
Converts any string into a string that is safe to use as a file name.
|
static void |
writeBinaryFile(File path,
byte[] contents) |
static void |
writeText(File path,
String text) |
static void |
writeText(File path,
String text,
String encoding) |
protected static final int MAX_DIR_NAME_LENGTH
protected static final int MAX_FILE_NAME_LENGTH
public static String getDefaultDataDirectory()
public static String getDefaultStoreDirectory()
public static String getDefaultDirectoryPrefix()
public static String toFileSystemDirectorySafeName(String name)
name - public static String toFileSystemSafeName(String name, boolean dirSeparators, int maxFileLength)
name - dirSeparators - maxFileLength - public static boolean deleteFile(File fileToDelete)
public static boolean deleteChildren(File parent)
public static void moveFile(File src, File targetDirectory) throws IOException
IOExceptionpublic static void copyFile(File src, File dest) throws IOException
IOExceptionpublic static String readText(File path) throws IOException
IOExceptionpublic static String readText(File path, String encoding) throws IOException
IOExceptionpublic static String readText(InputStream in) throws IOException
IOExceptionpublic static String readText(InputStream in, String encoding) throws IOException
IOExceptionpublic static byte[] readBytes(File path) throws IOException
IOExceptionpublic static byte[] readBytes(InputStream in) throws IOException
IOExceptionpublic static void writeText(File path, String text) throws IOException
IOExceptionpublic static void writeText(File path, String text, String encoding) throws IOException
IOExceptionpublic static void writeBinaryFile(File path, byte[] contents) throws IOException
IOExceptionpublic static void copyInputStream(InputStream in, OutputStream out) throws IOException
IOExceptionpublic static void close(Writer out)
public static void close(OutputStream out)
public static void close(InputStream in)
public static void mkdirs(File dir) throws IOException
IOExceptionpublic static void sync(FileDescriptor fd) throws IOException
IOExceptionpublic static void hardlink(File source, File target) throws IOException
IOExceptionpublic static CLibrary getCLibrary() throws ClassNotFoundException, IllegalAccessException, NoSuchFieldException
public static Kernel32Library getKernel32Library() throws ClassNotFoundException, IllegalAccessException, NoSuchFieldException
Copyright © 2005–2015 The Apache Software Foundation. All rights reserved.