|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ru.novosoft.dc.core.IOService
The class contains miscellaneous static I/O service methods.
Method Summary | |
static java.lang.String |
appendExtension(java.lang.String path,
java.lang.String extension)
Append the specified extension to the path, if the path just not has this extension yet, and return the result. |
static void |
closeOut(java.io.OutputStream out)
Close the output stream and catch the IOException. |
static boolean |
createDirectory(java.lang.String path)
Try to create a directory with the specified path and return true if the directory already exists or the creation was successful. |
static java.lang.String |
createPath(java.lang.String path,
java.lang.String extension)
Create a new path by replacing the extension of the specified path to the specified extension. |
static java.lang.String |
findFile(java.lang.String path)
Try to find a file at the specified path. |
static java.lang.String |
findFile(java.lang.String homePath,
java.lang.String path)
Try to find a file at the specified path by the following
algorithm:
If the path starts with "file:" or "file:/" protocol, the protocol
is removed and the file is searched as is.
|
static java.lang.String |
findFileInResources(java.lang.String path)
Try to find a file in resources (in path list specified in the Java classpath variable) and return the canonical path to it or null if search fails. |
static java.lang.String |
findHomePath(java.lang.String propertyName)
Find a home path using a value of system property with the specified propertyName name and return it. |
static java.util.Properties |
loadPropertiesFrom(java.io.File file)
Try to load properties from a specified file. |
static java.util.Properties |
loadPropertiesFrom(java.io.InputStream stream)
Try to load properties from a specified stream. |
static java.util.Properties |
loadPropertiesFrom(java.lang.String path)
Try to load properties from file at the specified path. |
static java.io.OutputStream |
openForWriting(java.lang.String path)
Try to open a file in the specified path for writing with creating of all parent directories if necessary. |
static java.lang.String |
removeFileProtocol(java.lang.String path)
Test a path to start with the "file:" protocol and remove it from the path name. |
static java.lang.String |
removeFileProtocol(java.lang.String path,
boolean mustExist)
Test a path to start with the "file:" protocol and remove it from the path name. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Method Detail |
public static java.lang.String createPath(java.lang.String path, java.lang.String extension)
path
- a path to replace an extensionextension
- a new extension starting from the dot (e.g., ".log")public static java.lang.String appendExtension(java.lang.String path, java.lang.String extension)
path
- a path to append an extension toextension
- an extension to be appended (e.g., ".opt")public static java.lang.String findFile(java.lang.String path)
public static java.lang.String findFile(java.lang.String homePath, java.lang.String path)
path
by the following
algorithm:
homePath
and after unsuccessful
search it is searched as is.
homePath
.
public static java.lang.String findFileInResources(java.lang.String path)
public static java.lang.String findHomePath(java.lang.String propertyName)
propertyName
name and return it. If the property is undefined,
the first element of the CLASSPATH list is used as the home path.public static java.lang.String removeFileProtocol(java.lang.String path)
public static java.lang.String removeFileProtocol(java.lang.String path, boolean mustExist)
mustExist
parameter is true, we test it to be an
absolute path pointing to an existing file. If this file exist, we return
it. Otherwise, the extra slash is removed.public static boolean createDirectory(java.lang.String path)
public static final java.util.Properties loadPropertiesFrom(java.lang.String path)
public static java.util.Properties loadPropertiesFrom(java.io.File file)
public static java.util.Properties loadPropertiesFrom(java.io.InputStream stream)
public static java.io.OutputStream openForWriting(java.lang.String path) throws java.io.IOException
public static final void closeOut(java.io.OutputStream out)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |