| java.lang.Object org.opencms.file.CmsResource org.opencms.file.CmsFile
All known Subclasses: org.opencms.file.history.CmsHistoryFile,
CmsFile | public class CmsFile extends CmsResource implements Cloneable,Serializable,Comparable(Code) | | 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.
author: Alexander Kandzior author: Michael Emmerich version: $Revision: 1.30 $ since: 6.0.0 |
Constructor Summary | |
public | CmsFile(CmsResource resource) | public | 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) |
CmsFile | public CmsFile(CmsResource resource)(Code) | | 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.
Parameters: resource - the base resource object to create a file from |
CmsFile | public 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)(Code) | | Constructor, creates a new file object.
Parameters: structureId - the id of this resources structure record Parameters: resourceId - the id of this resources resource record Parameters: path - the filename of this resource Parameters: type - the type of this resource Parameters: flags - the flags of this resource Parameters: projectId - the project id this resource was last modified in Parameters: state - the state of this resource Parameters: dateCreated - the creation date of this resource Parameters: userCreated - the id of the user who created this resource Parameters: dateLastModified - the date of the last modification of this resource Parameters: userLastModified - the id of the user who did the last modification of this resource Parameters: dateReleased - the release date of this resource Parameters: dateExpired - the expiration date of this resource Parameters: linkCount - the count of all siblings of this resource Parameters: length - the size of the file content of this resource Parameters: dateContent - the date of the last modification of the content of this resource Parameters: version - the version number of this resource Parameters: content - the binary content data of this file |
clone | public Object clone()(Code) | | Returns a clone of this Objects instance.
a clone of this instance |
getContents | public byte[] getContents()(Code) | | Returns the content of this file.
the content of this file |
setContents | public void setContents(byte[] value)(Code) | | Sets the contents of this file.
This will also set the date content, but only if the content is already set.
Parameters: value - the content of this file |
upgrade | public static CmsFile upgrade(CmsResource resource, CmsObject cms) throws CmsException(Code) | | Utility method to upgrade a CmsResource to a CmsFile.
Sometimes a CmsResource might already be a (casted) CmsFile that
also has the contents read. This method 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.
Parameters: resource - the resource to upgrade Parameters: cms - permission context for accessing the VFS the upgraded (or read) file throws: CmsException - if something goes wrongCmsObject.readFile(CmsResource) |
|
|