public void writeObject(Object o) throws MessageFormatException {
   StreamItem item = new StreamItem();
   if (o instanceof Boolean) {
     item.booleanValue((Boolean) o);
   } else if (o instanceof Byte) {
     item.byteValue((Byte) o);
   } else if (o instanceof Short) {
     item.shortValue((Short) o);
   } else if (o instanceof Character) {
     item.charValue((Character) o);
   } else if (o instanceof Integer) {
     item.intValue((Integer) o);
   } else if (o instanceof Long) {
     item.longValue((Long) o);
   } else if (o instanceof Float) {
     item.floatValue((Float) o);
   } else if (o instanceof Double) {
     item.doubleValue((Double) o);
   } else if (o instanceof String) {
     item.stringValue((String) o);
   } else if (o instanceof byte[]) {
     item.byteArrayValue((byte[]) o);
   } else {
     throw new MessageFormatException("Invalid value type passed in for writeObject()");
   }
   items.add(item);
 }
 public void writeBoolean(boolean b) {
   StreamItem item = new StreamItem();
   item.booleanValue(b);
   items.add(item);
 }