package com.perforce.client.api; import java.io.*; /** * Perforce file I/O. * * The FileSys class provides a platform-independent set of methods used to * create, read and write files to disk. * * <p> You can intercept the file I/O and implement your own client workspace * file access routines by replacing {@link ClientUser#file} in a ClientUser * subclass. * * <dl><dt> <b>Note</b> * <dd> <hr> Replacing the existing I/O routines is non-trivial. Your replacement routines * must handle all special cases, including cross-platform file issues. * * <dd> Unless your application has highly specialized requirements, (for instance, * performing all file I/O in memory rather than on disk), this approach is not recommended. * <hr></dl> * * <p> If you intend to replace {@link ClientUser#file file()}, all of the virtual methods * documented are required. The non virtual methods are not required and not documented. */ public class FileSys { private boolean javaCreatedTheInstance; long instance = 0; // private static native long nNewInstance(); private static native void nDeleteInstance(long instance); private File javaFile = null; /* FileSys() { this.instance = nNewInstance(); javaCreatedTheInstance = true; } */ FileSys(long instance) { this.instance = instance; javaCreatedTheInstance = false; } protected void finalize() throws Throwable { if (javaCreatedTheInstance) { nDeleteInstance(this.instance); } super.finalize(); } private static native String nName(long instance); private File iGetFile() { if (javaFile == null) { javaFile = new File(nName(this.instance)); } return javaFile; } public File getJavaFile() { return iGetFile(); } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 4181 | Paul Krause |
Rename //guest/paul_krause/perforce/api/java/wcvm/com/... //guest/paul_krause/perforce/api/java/wcvm/javax/... To //guest/paul_krause/perforce/api/java/wcvm/src-15/... |
||
//guest/paul_krause/perforce/api/java/wcvm/com/perforce/client/api/FileSys.java | |||||
#3 | 4130 | Paul Krause | Copy Javadoc from Perforce 2003.2 C/C++ API User's Guide. | ||
#2 | 4100 | Paul Krause | fix type problems | ||
#1 | 4073 | Paul Krause | branch com.perforce.api package from michael_bishop | ||
//guest/michael_bishop/P4APIForJava/java/com/perforce/client/api/FileSys.java | |||||
#1 | 430 | Michael Bishop |
Initial checkin. Seems to work. Not very much testing. Not very much documentation. Some more commenting needs to take place. But, it's there to experiment with. |