java.io.Serializable
, java.lang.Comparable<java.io.File>
public class CMFile
extends java.io.File
Modifier and Type | Class | Description |
---|---|---|
static class |
CMFile.CMFileManager |
FileManager handler for CMFile, used by WebServer
|
static class |
CMFile.CMVFSDir |
A class to represent a VFS/database directory.
|
static class |
CMFile.CMVFSFile |
Modifier and Type | Field | Description |
---|---|---|
static int |
FLAG_FORCEALLOW |
Flag for opening a CMFile to force allowing a given user to open despite security
|
static int |
FLAG_LOGERRORS |
Flag for opening a CMFile to suppress error logging
|
static int |
VFS_MASK_ATTACHMENT |
|
static int |
VFS_MASK_MASKSAVABLE |
Flag for a CMVFSDir object, allowing you to open it
|
Constructor | Description |
---|---|
CMFile(java.lang.String absolutePath,
MOB user) |
Constructor for a CMFS file from a full path.
|
CMFile(java.lang.String absolutePath,
MOB user,
int flagBitmap) |
Constructor for a CMFS file from a full path.
|
Modifier and Type | Method | Description |
---|---|---|
java.lang.String |
author() |
Returns the author of this file, if available.
|
boolean |
canExecute() |
|
boolean |
canLocalEquiv() |
Returns true if reading this file as local file is possible, or this directory is permitted.
|
boolean |
canRead() |
|
boolean |
canVFSEquiv() |
Returns true if reading this file as VFS is possible, or this directory is permitted.
|
boolean |
canWrite() |
|
int |
compareTo(java.io.File pathname) |
|
boolean |
createNewFile() |
|
boolean |
delete() |
|
boolean |
deleteAll() |
Same as delete, though it deletes both vfs and local
versions of a file unless the file is specified as
vfs or local.
|
boolean |
deleteLocal() |
If permitted, deletes this file from local
filesystem
|
void |
deleteOnExit() |
|
boolean |
deleteVFS() |
If permitted, deletes this file from VFS
(database) filesystem
|
boolean |
demandedLocal() |
Returns true if this file was opened only as a local file,
and not as a VFS file.
|
boolean |
demandedVFS() |
Returns true if this file was opened only as a vfs file,
and not as a local file.
|
boolean |
equals(java.lang.Object obj) |
|
boolean |
exists() |
|
java.io.File |
getAbsoluteFile() |
|
java.lang.String |
getAbsolutePath() |
|
java.io.File |
getCanonicalFile() |
|
java.lang.String |
getCanonicalPath() |
|
static CMFile[] |
getFileList(java.lang.String path,
MOB user,
boolean recurse,
boolean expandDirs,
java.util.Set<java.lang.String> skipDirs) |
Returns CMFiles list for a directory at a given path
|
long |
getFreeSpace() |
|
java.lang.String |
getIOReadableLocalPathAndName() |
Returns the local path and name that can be used
for a local file.
|
java.lang.String |
getLocalPathAndName() |
Returns local file path and name in simple form.
|
java.lang.String |
getName() |
|
java.lang.String |
getParent() |
|
CMFile |
getParentFile() |
|
java.lang.String |
getPath() |
|
java.io.InputStream |
getRawStream() |
Reads and returns all of the data in this file as a byte
input stream.
|
java.io.InputStream |
getTextStream() |
Reads and returns all of the data in this file as an
converted text stream.
|
long |
getTotalSpace() |
|
java.io.InputStream |
getUnformattedTextStream() |
Reads and returns all of the data in this file as an
unconverted text stream.
|
long |
getUsableSpace() |
|
static CMFile.CMVFSDir |
getVFSDirectory() |
Returns the entire VFS (database file) tree.
|
java.lang.String |
getVFSPathAndName() |
Returns the path and name of this file.
|
int |
hashCode() |
|
boolean |
isAbsolute() |
|
boolean |
isDirectory() |
|
boolean |
isFile() |
|
boolean |
isHidden() |
|
boolean |
isLocalDirectory() |
If this file represents (or could represent) a local dir, true
|
boolean |
isLocalFile() |
Returns true if writing to this will write to a local file.
|
boolean |
isVFSDirectory() |
If this file represents (or could represent) a VFS (database) dir,
returns true.
|
boolean |
isVFSFile() |
Returns true if writing to this will write to a VFS file.
|
boolean |
isVFSOnlyPathFile() |
If this file represents (or could represent) a VFS (database) file,
because the directory path is vfs only, this returns true.
|
long |
lastModified() |
|
long |
length() |
|
java.lang.String[] |
list() |
|
java.lang.String[] |
list(java.io.FilenameFilter filter) |
|
CMFile[] |
listFiles() |
|
java.io.File[] |
listFiles(java.io.FileFilter filter) |
|
java.io.File[] |
listFiles(java.io.FilenameFilter filter) |
|
boolean |
mayDeleteIfDirectory() |
If this file is a directory and the directory
is empty of other stuff.
|
boolean |
mkdir() |
|
boolean |
mkdirs() |
|
boolean |
mustOverwrite() |
Weird function.
|
byte[] |
raw() |
Reads and returns all of the data in this file as a byte array.
|
boolean |
renameTo(java.io.File dest) |
|
boolean |
saveRaw(java.lang.Object data) |
Saves the given data to local file if demanded, or vfs
file if not.
|
boolean |
saveText(java.lang.Object data) |
Saves the given text data to local file if demanded, or vfs
file if not.
|
boolean |
saveText(java.lang.Object data,
boolean append) |
Saves the given text data to local file if demanded, or vfs
file if not.
|
boolean |
setExecutable(boolean executable) |
|
boolean |
setExecutable(boolean executable,
boolean ownerOnly) |
|
boolean |
setLastModified(long time) |
|
boolean |
setReadable(boolean readable) |
|
boolean |
setReadable(boolean readable,
boolean ownerOnly) |
|
boolean |
setReadOnly() |
|
boolean |
setWritable(boolean writable) |
|
boolean |
setWritable(boolean writable,
boolean ownerOnly) |
|
java.lang.StringBuffer |
text() |
Reads and returns all of the data in this file as an
converted text stringbuffer.
|
java.lang.StringBuffer |
textUnformatted() |
Reads and returns all of the data in this file as an
unconverted text stringbuffer.
|
java.lang.StringBuffer |
textVersion(byte[] bytes) |
Converts the given bytes to a stringbuffer, if it is one,
or returns null otherwise.
|
java.lang.String |
toString() |
|
static void |
unloadVFS() |
|
static java.lang.String |
vfsifyFilename(java.lang.String filename) |
Converts DOS style path/names to VFS type names.
|
public static final int VFS_MASK_MASKSAVABLE
public static final int FLAG_LOGERRORS
public static final int FLAG_FORCEALLOW
public static final int VFS_MASK_ATTACHMENT
public CMFile(java.lang.String absolutePath, MOB user)
absolutePath
- the path to the file to open/createuser
- the user to check for permissions onpublic CMFile(java.lang.String absolutePath, MOB user, int flagBitmap)
FLAG_LOGERRORS
and FLAG_FORCEALLOW
absolutePath
- the path to the file to open/createuser
- the user to check for permissions onflagBitmap
- bitmap flag to turn on error logging or force allowpublic static final void unloadVFS()
public final CMFile getParentFile()
getParentFile
in class java.io.File
public final boolean mustOverwrite()
public final boolean canExecute()
canExecute
in class java.io.File
public final boolean canRead()
canRead
in class java.io.File
public final boolean canWrite()
canWrite
in class java.io.File
public final boolean demandedVFS()
public final boolean demandedLocal()
public final boolean isDirectory()
isDirectory
in class java.io.File
public final boolean exists()
exists
in class java.io.File
public final boolean isFile()
isFile
in class java.io.File
public final long lastModified()
lastModified
in class java.io.File
public final java.lang.String author()
public final boolean isLocalFile()
public final boolean isVFSFile()
public final boolean canVFSEquiv()
public final boolean canLocalEquiv()
public final java.lang.String getName()
getName
in class java.io.File
public final java.lang.String getAbsolutePath()
getAbsolutePath
in class java.io.File
public final java.lang.String getCanonicalPath()
getCanonicalPath
in class java.io.File
public final java.lang.String getLocalPathAndName()
public final java.lang.String getIOReadableLocalPathAndName()
public final java.lang.String getVFSPathAndName()
public final boolean mayDeleteIfDirectory()
public final boolean deleteLocal()
public final boolean deleteVFS()
public final boolean deleteAll()
public final boolean delete()
delete
in class java.io.File
public final java.io.InputStream getTextStream()
public final java.lang.StringBuffer text()
public final java.io.InputStream getUnformattedTextStream()
public final java.lang.StringBuffer textUnformatted()
public final java.io.InputStream getRawStream()
public final byte[] raw()
public final java.lang.StringBuffer textVersion(byte[] bytes)
bytes
- the bytes to convertpublic boolean saveRaw(java.lang.Object data)
data
- string, stringbuffer, byte[], or string convertablepublic boolean saveText(java.lang.Object data)
data
- string, stringbuffer, byte[], or string convertablepublic boolean saveText(java.lang.Object data, boolean append)
data
- string, stringbuffer, byte[], or string convertableappend
- true to append, false to overwritepublic final boolean mkdir()
mkdir
in class java.io.File
public final java.lang.String[] list()
list
in class java.io.File
public final boolean isVFSDirectory()
public final boolean isVFSOnlyPathFile()
public final boolean isLocalDirectory()
public final CMFile[] listFiles()
listFiles
in class java.io.File
public static final CMFile.CMVFSDir getVFSDirectory()
public static final java.lang.String vfsifyFilename(java.lang.String filename)
filename
- the filename to convertpublic static final CMFile[] getFileList(java.lang.String path, MOB user, boolean recurse, boolean expandDirs, java.util.Set<java.lang.String> skipDirs)
path
- the full path of the directory to get list fromuser
- user, for security checksrecurse
- true to recurse deep dirs, false otherwiseexpandDirs
- if path is a dir, return contents, otherwise selfskipDirs
- if recursing dirs, this will skip listed pathspublic int compareTo(java.io.File pathname)
compareTo
in interface java.lang.Comparable<java.io.File>
compareTo
in class java.io.File
public boolean createNewFile() throws java.io.IOException
createNewFile
in class java.io.File
java.io.IOException
public void deleteOnExit()
deleteOnExit
in class java.io.File
public boolean equals(java.lang.Object obj)
equals
in class java.io.File
public java.io.File getAbsoluteFile()
getAbsoluteFile
in class java.io.File
public java.io.File getCanonicalFile()
getCanonicalFile
in class java.io.File
public long getFreeSpace()
getFreeSpace
in class java.io.File
public java.lang.String getParent()
getParent
in class java.io.File
public java.lang.String getPath()
getPath
in class java.io.File
public long getTotalSpace()
getTotalSpace
in class java.io.File
public long getUsableSpace()
getUsableSpace
in class java.io.File
public int hashCode()
hashCode
in class java.io.File
public boolean isAbsolute()
isAbsolute
in class java.io.File
public boolean isHidden()
isHidden
in class java.io.File
public long length()
length
in class java.io.File
public java.lang.String[] list(java.io.FilenameFilter filter)
list
in class java.io.File
public java.io.File[] listFiles(java.io.FileFilter filter)
listFiles
in class java.io.File
public java.io.File[] listFiles(java.io.FilenameFilter filter)
listFiles
in class java.io.File
public boolean mkdirs()
mkdirs
in class java.io.File
public boolean renameTo(java.io.File dest)
renameTo
in class java.io.File
public boolean setExecutable(boolean executable)
setExecutable
in class java.io.File
public boolean setExecutable(boolean executable, boolean ownerOnly)
setExecutable
in class java.io.File
public boolean setLastModified(long time)
setLastModified
in class java.io.File
public boolean setReadable(boolean readable)
setReadable
in class java.io.File
public boolean setReadable(boolean readable, boolean ownerOnly)
setReadable
in class java.io.File
public boolean setReadOnly()
setReadOnly
in class java.io.File
public boolean setWritable(boolean writable)
setWritable
in class java.io.File
public boolean setWritable(boolean writable, boolean ownerOnly)
setWritable
in class java.io.File
public java.lang.String toString()
toString
in class java.io.File