Package org.cdlib.mrt.utility
Class FileTrans
java.lang.Object
org.cdlib.mrt.utility.FileTrans
This routine is used to normalize file names using a provided translation Map
If the map is not provided then a default normalization translation is used
Default translation is made on x'80' - x'9F'
Example: default
FileTrans fileTrans = new FileTrans(sourceFile);
try {
fileTrans.translate();
...
} catch (Exception ex) {
...
}
Example: provided translation
FileTrans fileTrans = new FileTrans(sourceFile, tranTable);
try {
fileTrans.translate();
...
} catch (Exception ex) {
...
}
- Author:
- dloy
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
deleteEmpty
(File testFile, File stopDir) Remove empty directoriesstatic void
static String
normExtension
(String inName) Lower case extension if present Note extension is defined here as characters following trailing period with 5 or less characters This test is only performed on files that contain a translationstatic String
Translate directory name using translation Mapvoid
-
Field Details
-
NAME
- See Also:
-
MESSAGE
- See Also:
-
BUFSIZE
protected static final int BUFSIZE- See Also:
-
DEFAULT_TIMEOUT
protected static final int DEFAULT_TIMEOUT- See Also:
-
-
Constructor Details
-
FileTrans
File name normalization using default translation Map- Parameters:
sourceFile
- top level directory entry to begin translation- Throws:
TException
-
FileTrans
File name normalization using provided translation Map- Parameters:
sourceFile
- top level directory entry to begin translationtranTable
- translation Map- Throws:
TException
-
-
Method Details
-
translate
- Throws:
TException
-
main
- Throws:
TException
-
deleteEmpty
Remove empty directories- Parameters:
testFile
- top directorystopDir
- top directory- Throws:
TException
-
tran
Translate directory name using translation Map- Parameters:
inName
- file name to be translatedtranTable
- translation Map- Returns:
- null = no translation required !null = tranlated name
- Throws:
Exception
-
normExtension
Lower case extension if present Note extension is defined here as characters following trailing period with 5 or less characters This test is only performed on files that contain a translation- Parameters:
inName
-- Returns:
- inName with lower case extension
- Throws:
Exception
-