com.melloware.jukes.file
Class FileUtil

java.lang.Object
  extended by com.melloware.jukes.file.FileUtil

public final class FileUtil
extends java.lang.Object

Static class of file utilities.

Copyright: Copyright (c) 2006 Company: Melloware, Inc.

Version:
4.0
Author:
Emil A. Lefkof III

Field Summary
static java.lang.String NIX_COMMAND
           
static java.lang.String WINDOWS_COMMAND
           
 
Method Summary
static java.lang.String capitalize(java.lang.String aStringToCapitalize)
          Provides title casing for a string and a set of characters to always capitalize after like "(".
static void checkValidFileName(java.lang.String aFilename, java.lang.String message)
          Checks a file name for invalid characters \\, /, :, , *, ?, ", <, >, or |
static java.lang.String correctFileName(java.lang.String aFilename)
          Corrects a file name for invalid characters.
static java.util.Map deepCopy(java.util.Map src)
          Deep copy of a Map.
static boolean rename(java.lang.String sOldname, java.lang.String sNewname)
          Renames a file.
static void setReadOnly(java.io.File aFile, boolean flag)
          Sets a file read only or not using the OS specific commands.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WINDOWS_COMMAND

public static final java.lang.String WINDOWS_COMMAND
See Also:
Constant Field Values

NIX_COMMAND

public static final java.lang.String NIX_COMMAND
See Also:
Constant Field Values
Method Detail

setReadOnly

public static void setReadOnly(java.io.File aFile,
                               boolean flag)
Sets a file read only or not using the OS specific commands. For JDK6 this is not needed as it has File.setReadable(true);

Parameters:
aFile - the file to set readonly
flag - true for readonly, false for writeable

capitalize

public static java.lang.String capitalize(java.lang.String aStringToCapitalize)
Provides title casing for a string and a set of characters to always capitalize after like "(".

Parameters:
aStringToCapitalize - the string to capitalize
Returns:
the captilized string

checkValidFileName

public static void checkValidFileName(java.lang.String aFilename,
                                      java.lang.String message)
Checks a file name for invalid characters \\, /, :, , *, ?, ", <, >, or |

Parameters:
aFilename - the filename to check

correctFileName

public static java.lang.String correctFileName(java.lang.String aFilename)
Corrects a file name for invalid characters. e.g. \\, /, :, , *, ?, ", <, >, or |

Parameters:
aFilename - the filename to check
Returns:
the corrected file name

deepCopy

public static java.util.Map deepCopy(java.util.Map src)
Deep copy of a Map.

Parameters:
src - the source Map
Returns:
return the deep copy.

rename

public static boolean rename(java.lang.String sOldname,
                             java.lang.String sNewname)
Renames a file.

Parameters:
sOldname - The current (old) name of the file.
sNewname - The new name of the file.
Returns:
true/false if the rename was successful.


Copyright © 1999-2008 Melloware Inc. All Rights Reserved.