org.nhindirect.stagent.parser
Class EntitySerializer

java.lang.Object
  extended by org.nhindirect.stagent.parser.EntitySerializer

public class EntitySerializer
extends java.lang.Object

Serializes and deserializes MimeParts objects.

Author:
Greg Meyer, Umesh Madan

Field Summary
static EntitySerializer Default
          Default EntitySerializer implementation.
 
Constructor Summary
EntitySerializer()
          Constructs a default EntitySerializer.
 
Method Summary
 javax.mail.internet.MimeMessage deserialize(byte[] messageBytes)
          Deserializes a MimeMessage from a raw byte array representation.
 javax.mail.internet.MimeMessage deserialize(java.io.InputStream stream)
          Deserializes a MimeMessage from an input stream.
 javax.mail.internet.MimeMessage deserialize(java.io.Reader reader)
          Deserializes a MimeMessage from a reader.
 javax.mail.internet.MimeMessage deserialize(java.lang.String messageText)
          Deserializes a MimeMessage from a raw String representation.
 java.lang.String serialize(java.util.Collection<javax.mail.internet.MimeBodyPart> parts, java.lang.String boundary)
          Serializes a collection of MimeBodyPart to a string with a given boundary.
 void serialize(java.util.Collection<javax.mail.internet.MimeBodyPart> parts, java.lang.String boundary, java.io.OutputStream stream)
          Serializes a collection of MimeBodyPart to an output stream with a given boundary.
 void serialize(java.util.Collection<javax.mail.internet.MimeBodyPart> parts, java.lang.String boundary, java.io.Writer writer)
          Serializes a collection of MimeBodyPart to a writer with a given boundary.
 java.lang.String serialize(javax.mail.internet.MimePart message)
          Serializes a MimePart to a String.
 void serialize(javax.mail.internet.MimePart message, java.io.OutputStream stream)
          Serializes a MimePart to and output stream.
 void serialize(javax.mail.internet.MimePart message, java.io.Writer writer)
          Serializes a MimePart to a writer.
 byte[] serializeToBytes(java.util.Collection<javax.mail.internet.MimeBodyPart> parts, java.lang.String boundary)
          Serializes a collection of MimeBodyPart to a byte array with a given boundary.
 byte[] serializeToBytes(javax.mail.internet.MimePart message)
          Serializes a MimePart to a byte array.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Default

public static final EntitySerializer Default
Default EntitySerializer implementation.

Constructor Detail

EntitySerializer

public EntitySerializer()
Constructs a default EntitySerializer.

Method Detail

serialize

public void serialize(javax.mail.internet.MimePart message,
                      java.io.OutputStream stream)
Serializes a MimePart to and output stream.

Parameters:
entity - The entity to serialize.
stream - The output stream that the serialized object will be written to.

serialize

public void serialize(javax.mail.internet.MimePart message,
                      java.io.Writer writer)
Serializes a MimePart to a writer.

Parameters:
entity - The entity to serialize.
stream - The writer that the serialized object will be written to.

serialize

public java.lang.String serialize(javax.mail.internet.MimePart message)
Serializes a MimePart to a String.

Parameters:
entity - The entity to serialize.
Returns:
A raw String representation of the entity.

serializeToBytes

public byte[] serializeToBytes(javax.mail.internet.MimePart message)
Serializes a MimePart to a byte array.

Parameters:
entity - The entity to serialize.
Returns:
A raw byte representation of the entity.

serialize

public void serialize(java.util.Collection<javax.mail.internet.MimeBodyPart> parts,
                      java.lang.String boundary,
                      java.io.Writer writer)
Serializes a collection of MimeBodyPart to a writer with a given boundary.

Parameters:
entity - The entities to serialize.
boundary - The boundary string that will separate each entity.
writer - The writer that the entities will be serialized to.

serialize

public java.lang.String serialize(java.util.Collection<javax.mail.internet.MimeBodyPart> parts,
                                  java.lang.String boundary)
Serializes a collection of MimeBodyPart to a string with a given boundary.

Parameters:
entity - The entities to serialize.
boundary - The boundary string that will separate each entity.
Returns:
A raw String representation of the serialized entities.

serialize

public void serialize(java.util.Collection<javax.mail.internet.MimeBodyPart> parts,
                      java.lang.String boundary,
                      java.io.OutputStream stream)
Serializes a collection of MimeBodyPart to an output stream with a given boundary.

Parameters:
entity - The entities to serialize.
boundary - The boundary string that will separate each entity.
stream - The output stream that the entities will be serialized to.

serializeToBytes

public byte[] serializeToBytes(java.util.Collection<javax.mail.internet.MimeBodyPart> parts,
                               java.lang.String boundary)
Serializes a collection of MimeBodyPart to a byte array with a given boundary.

Parameters:
entity - The entities to serialize.
boundary - The boundary string that will separate each entity.
Returns:
A raw byte array representation of the serialized entities.

deserialize

public javax.mail.internet.MimeMessage deserialize(java.io.InputStream stream)
Deserializes a MimeMessage from an input stream.

Parameters:
stream - The input stream containing the serialized entity.
Returns:
A MimeMessage deserialized from the input stream.

deserialize

public javax.mail.internet.MimeMessage deserialize(java.io.Reader reader)
Deserializes a MimeMessage from a reader.

Parameters:
stream - The reader containing the serialized entity.
Returns:
A MimeMessage deserialized from the reader.

deserialize

public javax.mail.internet.MimeMessage deserialize(java.lang.String messageText)
Deserializes a MimeMessage from a raw String representation.

Parameters:
stream - A raw String representation of the entity.
Returns:
A MimeMessage deserialized from the string.

deserialize

public javax.mail.internet.MimeMessage deserialize(byte[] messageBytes)
Deserializes a MimeMessage from a raw byte array representation.

Parameters:
stream - A raw byte array representation of the entity.
Returns:
A MimeMessage deserialized from the byte array.


Copyright © 2010-2011 HNIN Direct. All Rights Reserved.