SFRMMessage¶
-
public class
SFRMMessage
implements Cloneable¶ This is the SFRM Message used for wrapping the payload and send it to the receiver side. Specification: Creation Date: 29/9/2006 Version 1.0.2 -
- Add a message classifier for recognizing the message nature much easily.
Version 1.0.1 -
- MIC Value is stored into ContentMD5 in the MimeBodyPart.
- Support cloning.
Author: Twinsen Tsang
Fields¶
Constructors¶
SFRMMessage¶
-
public
SFRMMessage
(InputStream message)¶ Creates a new instance of SFRM Message.
Parameters: - message – the message as input stream.
Throws: - SFRMMessageException – if unable to construct from the given input stream.
SFRMMessage¶
-
public
SFRMMessage
(InternetHeaders headers, InputStream content)¶ Creates a new instance of SFRMMessage.
Parameters: - headers – the headers of this message.
- ins – the content stream.
Throws: - SFRMMessageException – if unable to construct from the given content stream.
Methods¶
addHeader¶
decrypt¶
-
public void
decrypt
(X509Certificate cert, PrivateKey privateKey)¶
digest¶
-
public static String
digest
(InputStream inStream)¶
digest¶
-
public static String
digest
(FileRegionDataSource frds)¶
encrypt¶
-
public void
encrypt
(X509Certificate cert, String encryptAlg)¶
getBodyPart¶
-
public MimeBodyPart
getBodyPart
()¶ Gets the MIME body part of this message.
Returns: the MIME body part.
getClassifier¶
-
public SFRMMessageClassifier
getClassifier
()¶ Returns: a message classifier for this message.
getContent¶
-
public Object
getContent
()¶ Gets the content of payload from this message.
Throws: - SFRMMessageException – if unable to get the content.
Returns: the content part.
getContentStream¶
-
public InputStream
getContentStream
()¶ Gets the content stream of this message.
Returns: the content stream of this message. null if there is no content.
getContentType¶
-
public String
getContentType
()¶ Gets the content type of the payload from this message.
Throws: - SFRMMessageException – if unable to get the content type.
Returns: the content type.
getConverationId¶
getFilename¶
getHeader¶
getHeader¶
getHeaders¶
-
public InternetHeaders
getHeaders
()¶ Gets the headers of this message.
Returns: a copy of the headers of this message.
getInputStream¶
-
public InputStream
getInputStream
()¶ Gets the input stream of this message’s content. Any transfer encodings will be decoded before the input stream is provided.
Throws: - SFRMMessageException – if unable to retrieve the stream.
Returns: the input stream of this message’s content.
getPartnershipId¶
getSegmentLength¶
-
public long
getSegmentLength
()¶ Returns: the SFRM segment length from this message.
getSegmentOffset¶
-
public long
getSegmentOffset
()¶ Returns: the SFRM segment offset position from the message.
removeHeader¶
setBodyPart¶
-
public void
setBodyPart
(MimeBodyPart bp)¶ Sets the MIME body part of this message.
Parameters: - bp – the new MIME body part.
setContent¶
-
public void
setContent
(Object content, String contentType)¶ Sets a content to this message.
Parameters: - content – the content part.
- contentType – the content type.
Throws: - SFRMMessageException – if unable to set the content.
setConversationId¶
setFilename¶
setHeader¶
setIsEncrypted¶
-
public void
setIsEncrypted
(boolean isEncrypted)¶ Set whether the message is encrypted.
Parameters: - isEncrypted – true if encrypted, false vice versa.
setIsSigned¶
-
public void
setIsSigned
(boolean isSigned)¶ Set whether the message is signed.
Parameters: - isSigned – true if signed, false vice versa.
setMessageID¶
setMicValue¶
setPartnershipId¶
setSegmentLength¶
-
public void
setSegmentLength
(long length)¶ Set the segment payload into this message. The segment length will only be set when it is greater than or equal to zero.
Parameters: - length – The length of this segment.
setSegmentNo¶
-
public void
setSegmentNo
(int segmentNo)¶ Set the segment number of the message. The segment number will only be set when it is greater than or equal to zero.
Parameters: - segmentNo – The segment number of message.
setSegmentOffset¶
-
public void
setSegmentOffset
(long offset)¶ Set the segment offset of this message. The segment offset will only be set when it is greater than or equal to zero.
Parameters: - offset – The offset of this segment.
setSegmentType¶
setTotalSegment¶
-
public void
setTotalSegment
(int totalSegment)¶ Set the total segment in the meta message.
Parameters: - totalSegment – The total segment of the message.
setTotalSize¶
-
public void
setTotalSize
(long totalSize)¶ Set the total size in the meta message.
Parameters: - totalSize – The total size of the message.
sign¶
-
public void
sign
(X509Certificate cert, PrivateKey privateKey, String digestAlg)¶
toByteArray¶
-
public byte[]
toByteArray
()¶ Returns a byte array which represents this message contnet.
Throws: - SFRMMessageException – if unable to convert this message into bytes.
Returns: a byte array which represents this message.
toByteBuffer¶
-
public ByteBuffer
toByteBuffer
(boolean hardwareBuffer)¶ Returns a byte buffer which represents this message content, i.e. a MIME body part byte buffer.
Parameters: - hardwareBuffer –
toString¶
-
public String
toString
()¶ Returns a string representation of this message.
Returns: a string representation of this message. See also:
java.lang.Object.toString()
verify¶
-
public void
verify
(X509Certificate cert)¶
writeTo¶
-
public void
writeTo
(OutputStream outs)¶ Writes the message to the given output stream.
Parameters: - outs – the output stream to be written.
Throws: - SFRMMessageException – if unable to write the message.