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.booleangetIsPDF()Returns if the briefing format is PDF.intgetSize()Returns the size of the image/file data.getText()Returns a text representation of the document.voidLoads a text document from a string.voidsetForcePDF(boolean isPDF) Forces the object type.voidsetForceSize(int size) Forces the object size.Methods inherited from class org.deltava.beans.DatabaseBlobBean
clear, getInputStream, isLoaded, load, loadMethods 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:DatabaseBlobBeanReturns the size of the image/file data.- Overrides:
getSizein 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
-