Overview | Package | Class | Tree | Serialized | 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, DigitalAsset, RenditionCapability, Resource, TargetableContentComponent, WCMApiObject

    public interface FileComponent

extends TargetableContentComponent, DigitalAsset, Resource, RenditionCapability

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 `FileComponent` is referred to as an `"File Element"`in the Authoring UI.``

See Also:
  `ContentComponent`

Nested Class Summary

Nested classes/interfaces inherited from interface com.ibm.workplace.wcm.api.digitalasset.DigitalAsset
`DigitalAsset.ResourceManagementOption`

Method Summary
`DocumentType<? extends FileComponent>` | `getDocumentType()` Returns the `DocumentType` of the `ContentComponent`.
`byte[]` | `getFile()` Deprecated. use `Resource.getBytes()`
`java.lang.String` | `getFileName()` Deprecated. use `Resource.getResourceName()`
`java.io.InputStream` | `getFileStream()` Deprecated. use `Resource.getInputStream()`
`void` | `removeFile()` Deprecated. use `Resource.removeResource()`
`void` | `setFile(java.lang.String fileName, byte[] file)` Deprecated. use `Resource.setResource(String, byte[])`
`void` | `setFile(java.lang.String fileName, java.io.File file)` Deprecated. use `Resource.setResource(String, File)`

Methods inherited from interface com.ibm.workplace.wcm.api.ContentComponent
`getContainer, getName`

Methods inherited from interface com.ibm.workplace.wcm.api.digitalasset.DigitalAsset
`getDigitalAssetID, getMetaData, getPath, getResourceManagementOption, isManagedExternally, setDigitalAssetID, setMetaData, setPath, setResourceManagementOption`

Methods inherited from interface com.ibm.workplace.wcm.api.Resource
`getBytes, getInputStream, getMimeType, getResourceName, getResourceURL, getSize, removeResource, setDeliverableOverCachingNetworkSupport, setResource, setResource, supportsDeliveryOverCachingNetwork`

Methods inherited from interface com.ibm.workplace.wcm.api.RenditionCapability
`createRendition, createRendition, getRendition, getRenditions, removeRendition`

Method Detail

### getDocumentType

    DocumentType<? extends FileComponent> getDocumentType()

  Description copied from interface: `ContentComponent`
  Returns the `DocumentType` of the `ContentComponent`.

  Specified by:
    `getDocumentType` in interface `ContentComponent`
  Specified by:
    `getDocumentType` in interface `TargetableContentComponent`
  Returns:
    the type
  See Also:
    `ContentComponent.getDocumentType()`

### getFile

    byte[] getFile()
                   throws AuthorizationException,
                          PropertyRetrievalException

  Deprecated. use `Resource.getBytes()`

  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 or is externally managed

### getFileStream

    java.io.InputStream getFileStream()
                                      throws AuthorizationException,
                                             PropertyRetrievalException

  Deprecated. use `Resource.getInputStream()`

  Returns the contents of the file contained within this component as a input stream

  Returns an empty byte array if no file has been set or the byte content could not be retrieved.

  Returns:
    the file content as a input stream
  Throws:
    `AuthorizationException` - if the user does not have access to the file
    `PropertyRetrievalException` - if the file cannot be retrieved or is externally managed
  Since:
    8.0.0.1

### getFileName

    java.lang.String getFileName()
                                 throws AuthorizationException,
                                        PropertyRetrievalException

  Deprecated. use `Resource.getResourceName()`

  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

  Deprecated. use `Resource.setResource(String, byte[])`

  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

  Deprecated. use `Resource.setResource(String, File)`

  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

  Deprecated. use `Resource.removeResource()`

  Removes file contained within this component.

  Throws:
    `OperationFailedException` - if an error occurred removing the file.

Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD