Package org.faceless.publisher.type
Class Blob
java.lang.Object
org.faceless.publisher.type.Blob
- All Implemented Interfaces:
AbstractBlob
A general purpose blob of data which can be text or binary.
To override, pass in a null byte[] and override getInputStream
-
Constructor Summary
ConstructorDescriptionBlob
(URL2 uri, MediaType type, InputStream in, long lastModified) Blob
(URL2 uri, MediaType type, ByteBuffer buf, long lastModified) -
Method Summary
Modifier and TypeMethodDescriptionlong
Return the byte-length of this attachment, or -1 if can't be determined yetReturn the filename as set by setAttachmentFileNamebyte[]
getBytes()
Return a copy of the byte datalong
Return the creation time as milliseconds since the UNIX Epoch if specified, or 0 otherwise.EmbeddedFile
getEmbeddedFile
(String name) Return a new PDF EmbeddedFile based on the blob;Return a new InputSource based on the character data if the charset is known, or the byte data otherwise.Return a new InputStream for the byte datalong
Return the last-modified time as milliseconds since the UNIX Epoch if specified, or 0 otherwiseReturn the MediaType, which will be set to WILDCARD if it was given as null;Return a new Reader for the character data, which will be UTF-8 if the charset is not set in the MediaTypeReturn a new Source based on the character data if a charset is known, or the byte data otherwise.Return the content of this Blob as a String, based on the byte data and thegetEncoding()
getURL()
Return the URL as set in the constructor, which may be nullboolean
Return true if a charset was specified.void
setAttachmentFileName
(String name) Set the (optional) filename set from the Content-Disposition headervoid
setCreationDate
(long date) Set the (optional) creation date.toString()
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.faceless.publisher.type.AbstractBlob
isTrusted
-
Constructor Details
-
Blob
-
Blob
-
Blob
-
Blob
- Throws:
IOException
-
Blob
- Throws:
IOException
-
-
Method Details
-
setCreationDate
public void setCreationDate(long date) Set the (optional) creation date.- Parameters:
date
- the creation date in milliseconds since the UNIX epoch, or 0 to mark as unset (the default)
-
setAttachmentFileName
Set the (optional) filename set from the Content-Disposition header -
getURL
Return the URL as set in the constructor, which may be null- Specified by:
getURL
in interfaceAbstractBlob
-
getAttachmentFileName
Return the filename as set by setAttachmentFileName -
getMediaType
Return the MediaType, which will be set to WILDCARD if it was given as null;- Specified by:
getMediaType
in interfaceAbstractBlob
-
getInputStream
Return a new InputStream for the byte data- Specified by:
getInputStream
in interfaceAbstractBlob
-
getReader
Return a new Reader for the character data, which will be UTF-8 if the charset is not set in the MediaType -
getInputSource
Return a new InputSource based on the character data if the charset is known, or the byte data otherwise. -
getSource
Return a new Source based on the character data if a charset is known, or the byte data otherwise. -
getEmbeddedFile
Return a new PDF EmbeddedFile based on the blob;- Parameters:
name
- the name to use, will override the attachment name if specified
-
getBytes
public byte[] getBytes()Return a copy of the byte data -
isCharsetSpecified
public boolean isCharsetSpecified()Return true if a charset was specified. -
getString
Return the content of this Blob as a String, based on the byte data and thegetEncoding()
-
getLastModified
public long getLastModified()Return the last-modified time as milliseconds since the UNIX Epoch if specified, or 0 otherwise- Specified by:
getLastModified
in interfaceAbstractBlob
-
getCreationDate
public long getCreationDate()Return the creation time as milliseconds since the UNIX Epoch if specified, or 0 otherwise. This is set bysetCreationDate(long)
- Specified by:
getCreationDate
in interfaceAbstractBlob
-
byteLength
public long byteLength()Description copied from interface:AbstractBlob
Return the byte-length of this attachment, or -1 if can't be determined yet- Specified by:
byteLength
in interfaceAbstractBlob
-
toString
-