|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.hibernate.search.util.impl.FileHelper
public abstract class FileHelper
Utility class for file and directory operations, like synchronisation and reading from class path.
Field Summary | |
---|---|
static long |
DEFAULT_COPY_BUFFER_SIZE
|
Constructor Summary | |
---|---|
FileHelper()
|
Method Summary | |
---|---|
static boolean |
areInSync(File source,
File destination)
|
static void |
closeResource(Closeable resource)
Closes a resource without throwing IOExceptions |
static boolean |
delete(File file)
Attempts to delete a file, and if it is a directory recurse to all content. |
static InputStream |
openResource(String resourceName)
|
static String |
readInputStream(InputStream inputStream)
Reads the provided input stream into a string |
static String |
readResourceAsString(String resourceName,
ClassLoader classLoader)
Load a resource from a specific classLoader |
static void |
synchronize(File source,
File destination,
boolean smart)
|
static void |
synchronize(File source,
File destination,
boolean smart,
long chunkSize)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final long DEFAULT_COPY_BUFFER_SIZE
Constructor Detail |
---|
public FileHelper()
Method Detail |
---|
public static boolean areInSync(File source, File destination) throws IOException
IOException
public static void synchronize(File source, File destination, boolean smart) throws IOException
IOException
public static void synchronize(File source, File destination, boolean smart, long chunkSize) throws IOException
IOException
public static boolean delete(File file)
file
- the file or Directory to be deleted
public static String readInputStream(InputStream inputStream) throws IOException
inputStream
- the input stream to read from
IOException
- in case an error occurs reading from the input streampublic static String readResourceAsString(String resourceName, ClassLoader classLoader)
resourceName
- the name of the resourceclassLoader
- the classloader to use, or null to try the ContextClassloader first or the loading one second.
public static InputStream openResource(String resourceName)
public static void closeResource(Closeable resource)
resource
- the resource to close
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |