|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.cotta.TFileFactory
public class TFileFactory
The factory class for creating TFile and TDirectory. The static methods are used for a quick way to create TFile and TDirectory with PhysicalFileSystem. There are two sets of static factories, one for factory creation and one for file/directory ceration
File factory creation:
TFile,
TDirectory| Field Summary | |
|---|---|
static TFileFactory |
PHYSICAL_FILE_FACTORY
Deprecated. use TFileFactory#phylical instead. This will become private |
| Constructor Summary | |
|---|---|
TFileFactory()
Creat the factory using physical file system |
|
TFileFactory(FileSystem fileSystem)
|
|
TFileFactory(FileSystem fileSystem,
java.lang.String defaultEncoding)
|
|
| Method Summary | |
|---|---|
static boolean |
canConvertUrl(java.net.URL url)
The method to check is an URL can be converted to TFile or TDirectory |
java.lang.String |
defaultEncoding()
|
static TDirectory |
dir(java.io.File file)
|
TDirectory |
dir(java.lang.String pathString)
Create the TDirectory that is represented by the path and backed by the file system |
TDirectory |
dir(TPath path)
Create the TDirectory that is repersented by the path and backed by the file system |
static TDirectory |
directoryFromJavaFile(java.io.File file)
Deprecated. use #physicalDir |
static TFile |
file(java.io.File file)
|
TFile |
file(java.lang.String pathString)
Create the TFile that is represented by the path and backed by the file system |
TFile |
file(TPath path)
Create the TFile that is repsented by the path and backed by the file system |
static TFile |
fileFromJavaFile(java.io.File file)
Deprecated. use file(java.io.File) |
static TFile |
fileFromUrl(java.net.URL url)
Create a TFile instance is represented by URL. |
static TFileFactory |
inMemory()
Creates a file factory with in-memory file system. |
static TFileFactory |
physical()
Retruns the shared file factory for the physical file system |
static TDirectory |
physicalDir(java.io.File file)
|
static TDirectory |
physicalDir(java.lang.String path)
|
static TFile |
physicalFile(java.io.File file)
|
static TFile |
physicalFile(java.lang.String path)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
@Deprecated public static final TFileFactory PHYSICAL_FILE_FACTORY
| Constructor Detail |
|---|
public TFileFactory()
PhysicalFileSystempublic TFileFactory(FileSystem fileSystem)
public TFileFactory(FileSystem fileSystem,
java.lang.String defaultEncoding)
| Method Detail |
|---|
public TFile file(java.lang.String pathString)
pathString - The path string that represents the file
TPath.parse(java.lang.String),
file(TPath)public TFile file(TPath path)
path - the path that represents the file
public TDirectory dir(java.lang.String pathString)
pathString - The pat string that represento the directory
TPath.parse(String),
dir(TPath)public TDirectory dir(TPath path)
path - the path that represents the directory
public static TFile fileFromUrl(java.net.URL url)
| Protocol | Sample code |
|---|---|
| jar | getClass().getResource(this.resourceString); |
| file | new java.io.File("/tmp/file.txt").toURL(); |
url - The url that points to a zipTo entry in a zipTo file
java.lang.IllegalArgumentException - if the url is not a zipTo file urlpublic static TFile fileFromJavaFile(java.io.File file)
file - the Java file object
PhysicalFileSystem,
physicalFile(java.io.File)@Deprecated public static TDirectory directoryFromJavaFile(java.io.File file)
file - the Java file object
PhysicalFileSystem,
physicalDir(java.io.File)public static boolean canConvertUrl(java.net.URL url)
url - The url
public static TFile physicalFile(java.lang.String path)
public static TFile physicalFile(java.io.File file)
public static TFile file(java.io.File file)
public static TDirectory physicalDir(java.lang.String path)
public static TDirectory physicalDir(java.io.File file)
public static TDirectory dir(java.io.File file)
public java.lang.String defaultEncoding()
public static TFileFactory inMemory()
public static TFileFactory physical()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||