|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opencms.file.CmsResource
org.opencms.file.CmsFile
public class CmsFile
A file resource in the OpenCms VFS.
A file resource is a CmsResource that contains an additional byte array of binary data, which is the file content.
A file object is not allowed to have sub-resources.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.opencms.file.CmsResource |
---|
CmsResource.CmsResourceCopyMode, CmsResource.CmsResourceDeleteMode, CmsResource.CmsResourceUndoMode |
Nested classes/interfaces inherited from interface org.opencms.file.I_CmsResource |
---|
I_CmsResource.CmsResourceAttribute |
Field Summary |
---|
Fields inherited from interface org.opencms.file.I_CmsResource |
---|
COMPARE_DATE_LAST_MODIFIED, COMPARE_DATE_RELEASED, COMPARE_ROOT_PATH, COMPARE_ROOT_PATH_IGNORE_CASE, COMPARE_ROOT_PATH_IGNORE_CASE_FOLDERS_FIRST |
Constructor Summary | |
---|---|
CmsFile(CmsResource resource)
Constructor, creates a new file Object from the given resource with an empty byte array as file content, if the resource does not implement a file. |
|
CmsFile(CmsUUID structureId,
CmsUUID resourceId,
String path,
int type,
int flags,
CmsUUID projectId,
CmsResourceState state,
long dateCreated,
CmsUUID userCreated,
long dateLastModified,
CmsUUID userLastModified,
long dateReleased,
long dateExpired,
int linkCount,
int length,
long dateContent,
int version,
byte[] content)
Constructor, creates a new file object. |
Method Summary | |
---|---|
Object |
clone()
Returns a clone of this Objects instance. |
byte[] |
getContents()
Returns the content of this file. |
int |
getLength()
Returns the content length of this resource. |
boolean |
isFile()
Returns true if the resource is a CmsFile , that is not a CmsFolder . |
boolean |
isFolder()
Returns true if the resource is a CmsFolder , that is not a CmsFile . |
boolean |
isTemporaryFile()
Returns true if this resource is a temporary file. |
void |
setContents(byte[] value)
Sets the contents of this file. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CmsFile(CmsResource resource)
resource
- the base resource object to create a file frompublic CmsFile(CmsUUID structureId, CmsUUID resourceId, String path, int type, int flags, CmsUUID projectId, CmsResourceState state, long dateCreated, CmsUUID userCreated, long dateLastModified, CmsUUID userLastModified, long dateReleased, long dateExpired, int linkCount, int length, long dateContent, int version, byte[] content)
structureId
- the id of this resources structure recordresourceId
- the id of this resources resource recordpath
- the filename of this resourcetype
- the type of this resourceflags
- the flags of this resourceprojectId
- the project id this resource was last modified instate
- the state of this resourcedateCreated
- the creation date of this resourceuserCreated
- the id of the user who created this resourcedateLastModified
- the date of the last modification of this resourceuserLastModified
- the id of the user who did the last modification of this resourcedateReleased
- the release date of this resourcedateExpired
- the expiration date of this resourcelinkCount
- the count of all siblings of this resourcelength
- the size of the file content of this resourcedateContent
- the date of the last modification of the content of this resourceversion
- the version number of this resourcecontent
- the binary content data of this fileMethod Detail |
---|
public Object clone()
clone
in class CmsResource
public byte[] getContents()
public int getLength()
CmsResource
If the resource is a file, then this is the byte size of the file content. If the resource is a folder, then the size is always -1.
getLength
in interface I_CmsResource
getLength
in class CmsResource
CmsResource.getLength()
public boolean isFile()
CmsResource
true
if the resource is a CmsFile
, that is not a CmsFolder
.
isFile
in interface I_CmsResource
isFile
in class CmsResource
CmsResource.isFile()
public boolean isFolder()
CmsResource
true
if the resource is a CmsFolder
, that is not a CmsFile
.
isFolder
in interface I_CmsResource
isFolder
in class CmsResource
CmsResource.isFolder()
public boolean isTemporaryFile()
CmsResource
true
if this resource is a temporary file.
A resource is considered a temporary file it is a file where the
CmsResource.FLAG_TEMPFILE
flag has been set, or if the file name (without parent folders)
starts with the prefix char '~'
(tilde).
isTemporaryFile
in class CmsResource
true
if the given resource name is a temporary fileCmsResource.isTemporaryFile()
public void setContents(byte[] value)
This will also set the date content, but only if the content is already set.
value
- the content of this file
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |