|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opencms.file.CmsResource
org.opencms.file.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.
Field Summary |
Constructor Summary | |
CmsFile(CmsResource resource)
Constructor, creates a new CmsFile Object from the given CmsResource with an empty byte array as file content. |
|
CmsFile(CmsUUID structureId,
CmsUUID resourceId,
CmsUUID contentId,
java.lang.String path,
int type,
int flags,
int projectId,
int state,
long dateCreated,
CmsUUID userCreated,
long dateLastModified,
CmsUUID userLastModified,
long dateReleased,
long dateExpired,
int linkCount,
int length,
byte[] content)
Constructor, creates a new CmsFile object. |
Method Summary | |
java.lang.Object |
clone()
Returns a clone of this Objects instance. |
CmsUUID |
getContentId()
Returns the id of the content database entry. |
byte[] |
getContents()
Returns the content of this file. |
int |
getLength()
Returns the length of the resource. |
boolean |
isFile()
Returns true if the resource is a file, i.e. can have no sub-resources. |
boolean |
isFolder()
Returns true if the resource is a folder, i.e. can have sub-resources. |
void |
setContents(byte[] value)
Sets the contents of this file. |
static CmsFile |
upgrade(CmsResource resource,
CmsObject cms)
Utility method to upgrade a CmsResource to a CmsFile. |
Methods inherited from class org.opencms.file.CmsResource |
checkResourceName, compareTo, equals, getDateCreated, getDateExpired, getDateLastModified, getDateReleased, getFlags, getFolderPath, getName, getName, getParentFolder, getPathLevel, getPathPart, getProjectLastModified, getResourceId, getRootPath, getSiblingCount, getState, getStructureId, getTypeId, getUserCreated, getUserLastModified, hashCode, isFolder, isInternal, isLabeled, isTouched, setDateExpired, setDateLastModified, setDateReleased, setFlags, setState, setType, setUserLastModified, toString |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.lang.Comparable |
compareTo |
Constructor Detail |
public CmsFile(CmsResource resource)
resource
- the base resource object to create a file frompublic CmsFile(CmsUUID structureId, CmsUUID resourceId, CmsUUID contentId, java.lang.String path, int type, int flags, int projectId, int state, long dateCreated, CmsUUID userCreated, long dateLastModified, CmsUUID userLastModified, long dateReleased, long dateExpired, int linkCount, int length, byte[] content)
structureId
- the id of this resources structure recordresourceId
- the id of this resources resource recordcontentId
- the id of this resources content recordpath
- the filename of this resoucetype
- 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 resourcecontent
- the binary content data of this fileMethod Detail |
public static CmsFile upgrade(CmsResource resource, CmsObject cms) throws CmsException
Sometimes a CmsResource might already be a (casted) CmsFile that also has the contents read. This methods tries to optimize read access to the VFS by "upgrading" the CmsResource to a CmsFile first. If this fails, the CmsFile is read from the VFS.
resource
- the resource to upgradecms
- permission context for accessing the VFS
CmsException
- if something goes wrongpublic java.lang.Object clone()
clone
in class CmsResource
public CmsUUID getContentId()
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 class CmsResource
CmsResource.getLength()
public boolean isFile()
CmsResource
true
if the resource is a file, i.e. can have no sub-resources.
isFile
in class CmsResource
CmsResource.isFile()
public boolean isFolder()
CmsResource
true
if the resource is a folder, i.e. can have sub-resources.
isFolder
in class CmsResource
CmsResource.isFolder()
public void setContents(byte[] value)
value
- the content of this file
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |