Package com.storedobject.core
Class FileContent
java.lang.Object
com.storedobject.core.FileContent
- All Implemented Interfaces:
Executable,ContentProducer,ContentType,RequiresTransactionManager,Runnable
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRetrieves the content as an InputStream.final StringgetError()Get the current error (set viaContentProducer.abort(Throwable)).getFile()Retrieves the file associated with this instance.Retrieves the file extension associated with the content.Retrieves the name of the file associated with the content.Retrieves the transaction manager associated with this object.voidproduce()Certain types of content may have to be produced.voidsetFileName(String fileName) voidSets the transaction manager for this object.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.storedobject.core.ContentProducer
abort, execute, extractContent, getEntity, getStreamData, getStreamDataProvider, getSystemEntity, ready, saveTo, saveTo, saveTo, saveToMethods inherited from interface com.storedobject.core.ContentType
getLink, getMimeType, isAudio, isHTML, isImage, isLink, isMedia, isPDF, isText, isVideoMethods inherited from interface com.storedobject.common.Executable
act, run
-
Constructor Details
-
FileContent
-
-
Method Details
-
produce
public void produce()Description copied from interface:ContentProducerCertain types of content may have to be produced. This method is used to do that.- Specified by:
producein interfaceContentProducer
-
getContent
Description copied from interface:ContentProducerRetrieves the content as an InputStream.Note: This may not invoke
ContentProducer.produce()and it may just return the content if it is already available. It is implementation-dependent.- Specified by:
getContentin interfaceContentProducer- Returns:
- an InputStream representing the content. This may be null if the content is not yet available.
- Throws:
Exception- if there is an error during content retrieval
-
getFileExtension
Description copied from interface:ContentProducerRetrieves the file extension associated with the content.- Specified by:
getFileExtensionin interfaceContentProducer- Returns:
- a String representing the file extension, or an empty string if no extension is available.
-
getFileName
Description copied from interface:ContentProducerRetrieves the name of the file associated with the content.- Specified by:
getFileNamein interfaceContentProducer- Returns:
- a String representing the name of the file, or null if the file name is unavailable.
-
setFileName
-
getContentType
- Specified by:
getContentTypein interfaceContentType
-
setTransactionManager
Description copied from interface:RequiresTransactionManagerSets the transaction manager for this object. The transaction manager is responsible for managing transaction boundaries.- Specified by:
setTransactionManagerin interfaceRequiresTransactionManager- Parameters:
tm- the transaction manager to be set
-
getTransactionManager
Description copied from interface:RequiresTransactionManagerRetrieves the transaction manager associated with this object.- Specified by:
getTransactionManagerin interfaceContentProducer- Specified by:
getTransactionManagerin interfaceRequiresTransactionManager- Returns:
- the transaction manager responsible for managing transaction boundaries
-
getError
Description copied from interface:ContentProducerGet the current error (set viaContentProducer.abort(Throwable)).- Specified by:
getErrorin interfaceContentProducer- Returns:
- Current error, if any.
-
getFile
Retrieves the file associated with this instance.- Returns:
- the file object that this instance represents
-