org.walluck.oscar.channel.aolim
Class MPMsg

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList
              extended by org.walluck.oscar.channel.aolim.MPMsg
All Implemented Interfaces:
Serializable, Cloneable, Iterable, Collection, List, RandomAccess

public class MPMsg
extends ArrayList

A multi-part message.

Ahh, the joys of nearly ridiculous over-engineering.

Not only do AIM ICBM's support multiple channels. Not only do they support multiple character sets, but they support multiple character sets/encodings within the same ICBM.

These multipart messages allow for complex space savings techniques, which seem utterly unnecessary by today's standards. In fact, there is only one client still in popular use that still uses this method: AOL for the Macintosh, Version 5.0. Obscure, yes, I know.

In modern (non-legacy) clients, if the user tries to send a character that is not ISO-8859-1 or ASCII, the client will send the entire message as UNICODE, meaning that every character in the message will occupy the full 16-bit UNICODE field, even if the high order byte would be zero. Multipart messages prevent this wasted space by allowing the client to only send the characters in UNICODE that need to be sent that way, and the rest of the message can be sent in whatever the native character set is (probably ASCII).

An important note is that sections will be displayed in the order that they appear in the ICBM. There is no facility for merging or rearranging sections at run time. So if you have, say, ASCII then UNICODE then ASCII, you must supply two ASCII sections with a UNICODE in the middle, and incur the associated overhead.

Normally I would have laughed and given a firm "no" to supporting this seldom-used feature, but something is attracting me to it. In the future, it may be possible to abuse this to send mixed-media messages to other open source clients (i.e., encryption).

I would definitely recommend avoiding this feature unless you really know what you are doing, and/or you have something neat to do with it.

Since:
1.0
Version:
1.0
Author:
Davd Walluck
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
MPMsg()
          Creates a new multi-part message.
MPMsg(int size)
          Creates a new multi-part message of the specified size.
 
Method Summary
 void addSection(MPMsgSection sec)
          Add a message section to the mutli-part message.
 void addSectionASCII(String ascii)
          Add an ASCII encoded string section to the multi-part message.
 void addSectionISO88591(String iso88591)
          Add an ISO-8859-1 string section to the multi-part message.
 void addSectionRaw(int charset, int charSubset, String data)
          Add a raw string section to the multi-part message.
 void addSectionUnicode(String unicode)
          Add a Unicode (UTF-16BE) string section to the multi-part message.
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Constructor Detail

MPMsg

public MPMsg()
Creates a new multi-part message.


MPMsg

public MPMsg(int size)
Creates a new multi-part message of the specified size.

Parameters:
size - the size
Method Detail

addSection

public void addSection(MPMsgSection sec)
Add a message section to the mutli-part message.

Parameters:
sec - the message section to add

addSectionRaw

public void addSectionRaw(int charset,
                          int charSubset,
                          String data)
Add a raw string section to the multi-part message.

Parameters:
charset - the character set
charSubset - the character subset
data - the raw string

addSectionASCII

public void addSectionASCII(String ascii)
Add an ASCII encoded string section to the multi-part message.

Parameters:
ascii - the ASCII encoded string

addSectionUnicode

public void addSectionUnicode(String unicode)
Add a Unicode (UTF-16BE) string section to the multi-part message.

Parameters:
unicode - the Unicode (UTF-16BE) encoded string

addSectionISO88591

public void addSectionISO88591(String iso88591)
Add an ISO-8859-1 string section to the multi-part message.

Parameters:
iso88591 - the ISO-8859-1 encoded string