Overview Package Class Tree Deprecated Index Help PREV CLASS NEXT CLASS FRAMES NO FRAMES SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD
com.ibm.workplace.wcm.api
Interface FileComponent
- All Superinterfaces:
- ContentComponent
public interface FileComponent- extends ContentComponent
Represents a File component.
A FileComponent is a ContentComponent and cannot be stored as a separate entity in the repository.
A FileComponent can contain one file. The contents of the file are dealt with as raw byte content. This interface provides methods to manipulate the file.
note: since v6.0.0, a ContentComponent is referred to as an "Element" in the Authoring UI.
- See Also:
- ContentComponent
Method Summary byte[] getFile()
Returns the contents of the file contained within this component as a byte array.java.lang.String getFileName()
Returns the filename of the file contained within this component.long getSize()
Returns the size in bytes of the file contained within this component.void removeFile()
Removes file contained within this component.void setFile(java.lang.String fileName, byte[] file)
Sets the file contained within this component.void setFile(java.lang.String fileName, java.io.File file)
Sets the file contained within this component.
Methods inherited from interface com.ibm.workplace.wcm.api.ContentComponent getContainer, getName
Method Detail getFile
byte[] getFile() throws AuthorizationException, PropertyRetrievalException
- Returns the contents of the file contained within this component as a byte array.
Returns an empty byte array if the byte content could not be retrieved.
- Returns:
- the file content as a byte array
- Throws:
- AuthorizationException - if the user does not have access to the file
- PropertyRetrievalException - if the file cannot be retrieved
getFileName
java.lang.String getFileName() throws AuthorizationException, PropertyRetrievalException
- Returns the filename of the file contained within this component.
Returns null if a file or filename has not been specified.
- Returns:
- the filename
- Throws:
- AuthorizationException - if the user does not have access to the file
- PropertyRetrievalException - if the file cannot be retrieved
setFile
void setFile(java.lang.String fileName, byte[] file) throws OperationFailedException
- Sets the file contained within this component.
This method does not accept null arguments. Passing a null argument into this method will result in a NullPointerException.
- Parameters:
- fileName - the name of the file
- file - the content of the file as a byte array
- Throws:
- java.lang.NullPointerException - if fileName or file is null
- OperationFailedException - if the file could not be set
setFile
void setFile(java.lang.String fileName, java.io.File file) throws OperationFailedException
- Sets the file contained within this component. This is more memory friendly then setting the bytes of the file.
This method does not accept null arguments. Passing a null argument into this method will result in a NullPointerException.
- Parameters:
- fileName - the name of the file
- file - the contents of the file as a file on the file system
- Throws:
- java.lang.NullPointerException - if fileName or file is null
- OperationFailedException - if the file could not be set
removeFile
void removeFile() throws OperationFailedException
- Removes file contained within this component.
- Throws:
- OperationFailedException - if an error occurred removing the file.
getSize
long getSize() throws AuthorizationException, PropertyRetrievalException
- Returns the size in bytes of the file contained within this component.
Returns -1 if a file has not been specified.
- Returns:
- the file size in bytes
- Throws:
- AuthorizationException - if the user does not have access to the file
- PropertyRetrievalException - if the file cannot be retrieved
Overview Package Class Tree Deprecated Index Help PREV CLASS NEXT CLASS FRAMES NO FRAMES SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD