org.apache.kahadb.util
Class IOHelper

java.lang.Object
  extended by org.apache.kahadb.util.IOHelper

public final class IOHelper
extends Object

Version:
$Revision: 712224 $

Field Summary
protected static int MAX_DIR_NAME_LENGTH
           
protected static int MAX_FILE_NAME_LENGTH
           
 
Method Summary
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 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 void mkdirs(File dir)
           
static void moveFile(File src, File targetDirectory)
           
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_DIR_NAME_LENGTH

protected static final int MAX_DIR_NAME_LENGTH

MAX_FILE_NAME_LENGTH

protected static final int MAX_FILE_NAME_LENGTH
Method Detail

getDefaultDataDirectory

public static String getDefaultDataDirectory()

getDefaultStoreDirectory

public static String getDefaultStoreDirectory()

getDefaultDirectoryPrefix

public 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


toFileSystemDirectorySafeName

public static String toFileSystemDirectorySafeName(String name)
Converts any string into a string that is safe to use as a file name. The result will only include ascii characters and numbers, and the "-","_", and "." characters.

Parameters:
name -
Returns:

toFileSystemSafeName

public static String toFileSystemSafeName(String name)

toFileSystemSafeName

public static String toFileSystemSafeName(String name,
                                          boolean dirSeparators,
                                          int maxFileLength)
Converts any string into a string that is safe to use as a file name. The result will only include ascii characters and numbers, and the "-","_", and "." characters.

Parameters:
name -
dirSeparators -
maxFileLength -
Returns:

deleteFile

public static boolean deleteFile(File fileToDelete)

deleteChildren

public static boolean deleteChildren(File parent)

moveFile

public static void moveFile(File src,
                            File targetDirectory)
                     throws IOException
Throws:
IOException

copyFile

public static void copyFile(File src,
                            File dest)
                     throws IOException
Throws:
IOException

copyInputStream

public static void copyInputStream(InputStream in,
                                   OutputStream out)
                            throws IOException
Throws:
IOException

mkdirs

public static void mkdirs(File dir)
                   throws IOException
Throws:
IOException


Copyright © 2005-2011 Apache Software Foundation. All Rights Reserved.