|
UC Berkeley Group for User Interface Research Updated November 17, 2000 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.berkeley.guir.lib.io.FileLib
Miscellaneous file librariesm, for manipulating files, directories, and class files.
This software is distributed under the Berkeley Software License.
Revisions: - GUIRLib-v1.0-1.0.0, Jan 29 1998, JH Created class - GUIRLib-v1.2-1.0.0, Jun 22 2000, JH Touched for GUIRLib release - GUIRLib-v1.3-1.0.0, Aug 11 2000, JH Touched for GUIRLib release - GUIRLib-v1.4-1.0.0, Aug 31 2000, JH Touched for GUIRLib release
Field Summary | |
static String |
CLASS_EXT
File extension for Java class files. |
static String |
FILE_PROTOCOL
HTTP file protocol header. |
static String |
SERIALIZED_EXT
File extension for serialized files. |
static String |
ZIP_EXT
File extension for zip files. |
Method Summary | |
static String |
addFileNameExtension(File f,
String strExtension)
Ensure that the filename ends with the specified extension. |
static String |
addFileNameExtension(String strFileName,
String strExtension)
Ensure that the filename ends with the specified extension. |
static String |
classNameToLocalSystem(String strClassName)
Fixes the class file name to the local system so it can be searched for in the local system. |
static String |
fileNameToURL(String strName)
Given a path name in the file system, convert it to a URL. |
static String |
generateUniqueFileName()
Generate a unique filename in the current directory. |
static String |
generateUniqueFileName(String strRoot,
String strExt)
Generate a unique filename in the current directory. |
static String |
generateUniqueFileName(String strPath,
String strRoot,
String strExt)
Generate a unique filename in the specified directory. |
static String |
getClassName(String strFullClassName)
Given a fully qualified class name, extract the class name out of it. |
static String |
getFileNameExtension(String strFileName)
Given the name of a file, get the file extension. |
static String |
getFilePath(String strFileName)
Given the name of a local file, get the absolute path of that file. |
static String[] |
getFilesInCurrentDirectory()
Get the name of all of the files in the current working directory. |
static String[] |
getFilesInDirectory(String strDir)
Get the name of all of the files in the specified directory. |
static String |
getPackageDirectory(String strFullClassName)
Given the fully qualified name of a class, get the directory of the package. |
static String |
getPackageName(String strFullClassName)
Given a fully qualified class name, extract the package name out of it. |
static boolean |
hasClassExtension(String strClassName)
See if the String ends with the ".class" extension. |
static String |
localNameToNetworkName(String strName)
Convert the filename (or path) from the local system format to an http-like format. |
static String |
localNameToZip(String strFileName)
Fixes a file name to conform to the zip file format. |
static String |
networkNameToLocalName(String strName)
Convert the filename (or path) from an http-like format to the local system format. |
static String |
stripClassExtension(String strClassName)
Drop the ".class" extension (if it exists). |
static String |
URLToFileName(String strName)
Given a URL to a file in the local file system, convert it to the file name. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String FILE_PROTOCOL
public static final String SERIALIZED_EXT
public static final String ZIP_EXT
public static final String CLASS_EXT
Method Detail |
public static String fileNameToURL(String strName)
strName
- is the name of the file (or path) to convert.public static String URLToFileName(String strName)
strName
- is the URL.public static String localNameToNetworkName(String strName)
strName
- is the name of the file (or path) to convert.public static String networkNameToLocalName(String strName)
strName
- is the name of the file (or path) to convert.public static String addFileNameExtension(String strFileName, String strExtension)
strFileName
- is the name of the file.strExtension
- is the file extension, e.g. "gif" or "dat".public static String addFileNameExtension(File f, String strExtension)
addFileNameExtension(String, String)
public static String getFileNameExtension(String strFileName)
strFileName
- is the name of the file.public static String getFilePath(String strFileName)
strFileName
- is the name of a file on the local system (using
local values for filename and path separators).public static String localNameToZip(String strFileName)
strFileName
- is the name of the file. For example, in
MS-DOS, strFileName could be "\temp\myfile.doc".public static String generateUniqueFileName()
public static String generateUniqueFileName(String strRoot, String strExt)
strRoot
- is the base of the file.strExt
- is the filename extension, "" for no extension.public static String generateUniqueFileName(String strPath, String strRoot, String strExt)
strPath
- is the base path of the file. Use "" for current
directory. Can end with or without trailing slash, like
"/etc/" or "/bin".strRoot
- is the base of the file, "" for no extension.strExt
- is the filename extension, "" for no extension.
For example, ".gif" or ".exe".public static String[] getFilesInCurrentDirectory()
Throws
- SecurityException if access to "user.dir" is denied.public static String[] getFilesInDirectory(String strDir)
public static String stripClassExtension(String strClassName)
strClassName
- is the name of a class (with or without package
names included).public static boolean hasClassExtension(String strClassName)
strClassName
- is the name of a class (with or without package
names included).public static String classNameToLocalSystem(String strClassName)
strClassName
- is the name of the Class to find in the form
of "java.lang.Object" or "Object.class".public static String getClassName(String strFullClassName)
strFullClassName
- is the fully qualified class name, including
packages. For example, "java.lang.Object" or
"java.lang.Object.class".public static String getPackageName(String strFullClassName)
strFullClassName
- is the fully qualified class name, including
packages. For example, "java.lang.Object" or
"java.lang.Object.class".public static String getPackageDirectory(String strFullClassName)
strFullClassName
- is the fully qualified class name, including
packages. For example, "java.lang.Object" or
"java.lang.Object.class".
|
Copyright Information | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |