|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.cocoon.util.IOUtils
public class IOUtils
A collection of File
, URL
and filename
utility methods
Constructor Summary | |
---|---|
IOUtils()
|
Method Summary | |
---|---|
static String |
baseName(String filename)
Deprecated. To be removed in cocoon 2.3 |
static Object |
bytesToObject(byte[] bytes)
Deprecated. To be removed in cocoon 2.3 |
static File |
createFile(File destDir,
String filename)
Return a file with the given filename creating the necessary directories if not present. |
static Object |
deserializeObject(File file)
Deprecated. To be removed in cocoon 2.3 |
static String |
deserializeString(File file)
Load a text file contents as a String |
static String |
fileComponent(String filename)
Deprecated. To be removed in cocoon 2.3 |
static String |
getContextFilePath(String directoryPath,
String filePath)
Return the path within a base directory |
static String |
getFullFilename(File file)
Get the complete filename corresponding to a (typically relative) File . |
static String |
normalizedFilename(String filename)
Return a modified filename suitable for replicating directory structures below the store's base directory. |
static byte[] |
objectToBytes(Object object)
Deprecated. To be removed in cocoon 2.3 |
static String |
pathComponent(String filename)
Deprecated. To be removed in cocoon 2.3 |
static void |
serializeObject(File file,
Object object)
Deprecated. To be removed in cocoon 2.3 |
static void |
serializeString(File file,
String string)
Deprecated. To be removed in cocoon 2.3 |
static void |
serializeString(File file,
String string,
String encoding)
Deprecated. To be removed in cocoon 2.3 |
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(File file, String string) throws IOException
String
to a text file.
file
- The output filestring
- The string to be dumped
IOException
- IO Errorpublic static void serializeString(File file, String string, String encoding) throws 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 encoding
IOException
- IO Errorpublic static String deserializeString(File file) throws IOException
String.
This method does not perform enconding conversions
- Parameters:
file
- The input file
- Returns:
- The file contents as a
String
- Throws:
IOException
- IO Error
public static void serializeObject(File file, Object object) throws IOException
file
- The output fileobject
- The object to be serialized
IOException
- IOErrorpublic static Object deserializeObject(File file) throws IOException, ClassNotFoundException
file
- The input file
IOException
- IOError
ClassNotFoundException
public static String normalizedFilename(String filename)
public static String pathComponent(String filename)
filename
- The filename
public static String fileComponent(String filename)
filename
- The filename
public static String baseName(String filename)
filename
- The filename
public static String getFullFilename(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 instead
file
- The file
public static String getContextFilePath(String directoryPath, String filePath)
public static File createFile(File destDir, String filename)
filename
- The file
public static byte[] objectToBytes(Object object) throws IOException
object
- to convert
IOException
public static Object bytesToObject(byte[] bytes) throws IOException, ClassNotFoundException
bytes
- array to convert
IOException
ClassNotFoundException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |