Class DatabaseDocumentBean
java.lang.Object
org.deltava.beans.DatabaseBean
org.deltava.beans.DatabaseBlobBean
org.deltava.beans.DatabaseDocumentBean
- All Implemented Interfaces:
Serializable
,Comparable<Object>
,IDBean
,Cacheable
An abstract bean that contains a document. This has helper methods that provide PDF detection and
allow the size to be loaded without loading the entire binary payload.
- Since:
- 10.0
- Version:
- 10.0
- Author:
- Luke
- See Also:
-
Field Summary
Fields inherited from class org.deltava.beans.DatabaseBlobBean
_buffer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
Returns the file buffer.Returns the document's MIME type.Returns the document's file extension.boolean
getIsPDF()
Returns if the briefing format is PDF.int
getSize()
Returns the size of the image/file data.getText()
Returns a text representation of the document.void
Loads a text document from a string.void
setForcePDF
(boolean isPDF) Forces the object type.void
setForceSize
(int size) Forces the object size.Methods inherited from class org.deltava.beans.DatabaseBlobBean
clear, getInputStream, isLoaded, load, load
Methods inherited from class org.deltava.beans.DatabaseBean
cacheKey, compareTo, equals, getHexID, getID, hashCode, setID, validateID, validateID
-
Constructor Details
-
DatabaseDocumentBean
public DatabaseDocumentBean()
-
-
Method Details
-
getBuffer
public byte[] getBuffer()Returns the file buffer.- Returns:
- the buffer
- Throws:
IllegalStateException
- if not loaded
-
getIsPDF
public boolean getIsPDF()Returns if the briefing format is PDF.- Returns:
- TRUE if PDF, otherwise FALSE
-
getSize
public int getSize()Description copied from class:DatabaseBlobBean
Returns the size of the image/file data.- Overrides:
getSize
in classDatabaseBlobBean
- Returns:
- the size of the data, in bytes. If the buffer is not initialized, returns -1
- See Also:
-
getContentType
-
getExtension
-
load
-
setForcePDF
public void setForcePDF(boolean isPDF) Forces the object type.- Parameters:
isPDF
- TRUE if a PDF, otherwise FALSE
-
setForceSize
public void setForceSize(int size) Forces the object size.- Parameters:
size
- the size in bytes
-
getText
Returns a text representation of the document. Since some subclasses may not just be a briefing document, this deliberately does not override toString().- Returns:
- the briefing text, or "PDF" if a PDF document
-