|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object | +--org.apache.cocoon.util.IOUtils
A collection of File, URL and filename
utility methods
| Constructor Summary | |
IOUtils()
|
|
| Method Summary | |
static java.lang.String |
baseName(java.lang.String filename)
Strip a filename of its last extension (the portion immediately following the last dot character, if any) |
static java.lang.Object |
bytesToObject(byte[] bytes)
Returns a object from the given byte array. |
static java.io.File |
createFile(java.io.File destDir,
java.lang.String filename)
Return a file with the given filename creating the necessary directories if not present. |
static java.lang.Object |
deserializeObject(java.io.File file)
This method deserializes an object from an input stream. |
static java.lang.String |
deserializeString(java.io.File file)
Load a text file contents as a String |
static java.lang.String |
fileComponent(java.lang.String filename)
Remove path information from a filename returning only its file component |
static java.lang.String |
getContextFilePath(java.lang.String directoryPath,
java.lang.String filePath)
Return the path within a base directory |
static java.lang.String |
getFullFilename(java.io.File file)
Get the complete filename corresponding to a (typically relative) File.
|
static java.lang.String |
normalizedFilename(java.lang.String filename)
Return a modified filename suitable for replicating directory structures below the store's base directory. |
static byte[] |
objectToBytes(java.lang.Object object)
Returns a byte array from the given object. |
static java.lang.String |
pathComponent(java.lang.String filename)
Remove file information from a filename returning only its path component |
static void |
serializeObject(java.io.File file,
java.lang.Object object)
This method serializes an object to an output stream. |
static void |
serializeString(java.io.File file,
java.lang.String string)
Dump a String to a text file. |
static void |
serializeString(java.io.File file,
java.lang.String string,
java.lang.String encoding)
Dump a String to a text file. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public IOUtils()
| Method Detail |
public static void serializeString(java.io.File file,
java.lang.String string)
throws java.io.IOException
String to a text file.file - The output filestring - The string to be dumpedjava.io.IOException - IO Error
public static void serializeString(java.io.File file,
java.lang.String string,
java.lang.String encoding)
throws java.io.IOException
String to a text file.file - The output filestring - The string to be dumpedencoding - The encoding for the output file or null for default platform encodingjava.io.IOException - IO Error
public static java.lang.String deserializeString(java.io.File file)
throws java.io.IOException
String.
This method does not perform enconding conversions
- Parameters:
file - The input file- Returns:
- The file contents as a
String - Throws:
java.io.IOException - IO Error
public static void serializeObject(java.io.File file,
java.lang.Object object)
throws java.io.IOException
file - The output fileobject - The object to be serializedjava.io.IOException - IOError
public static java.lang.Object deserializeObject(java.io.File file)
throws java.io.IOException,
java.lang.ClassNotFoundException
file - The input filejava.io.IOException - IOErrorpublic static java.lang.String normalizedFilename(java.lang.String filename)
public static java.lang.String pathComponent(java.lang.String filename)
filename - The filenamepublic static java.lang.String fileComponent(java.lang.String filename)
filename - The filenamepublic static java.lang.String baseName(java.lang.String filename)
filename - The filenamepublic static java.lang.String getFullFilename(java.io.File file)
File.
This method accounts for the possibility of an error in getting
the filename's canonical path, returning the io/error-safe
absolute form insteadfile - The file
public static java.lang.String getContextFilePath(java.lang.String directoryPath,
java.lang.String filePath)
public static java.io.File createFile(java.io.File destDir,
java.lang.String filename)
filename - The file
public static byte[] objectToBytes(java.lang.Object object)
throws java.io.IOException
object - to convert
public static java.lang.Object bytesToObject(byte[] bytes)
throws java.io.IOException,
java.lang.ClassNotFoundException
bytes - array to convert
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||