code: @Override
      public void writeObject(Object value) throws JMSException {
          if (value == null) {
              throw new NullPointerException("Cannot write null value of object");
          }
          if (value instanceof Boolean) {
              writeBoolean((Boolean) value);
          } else if (value instanceof Character) {
              writeChar((Character) value);
          } else if (value instanceof Byte) {
              writeByte((Byte) value);
          } else if (value instanceof Short) {
              writeShort((Short) value);
          } else if (value instanceof Integer) {
              writeInt((Integer) value);
          } else if (value instanceof Long) {
              writeLong((Long) value);
          } else if (value instanceof Float) {
              writeFloat((Float) value);
          } else if (value instanceof Double) {
              writeDouble((Double) value);
          } else if (value instanceof String) {
              writeUTF(value.toString());
          } else if (value instanceof byte[]) {
              writeBytes((byte[]) value);
          }
docs: Writes an object to the bytes message stream.
  <P>
  This method works only for the boxed primitive object types
  (Integer, Double, Long ...), String objects, and byte arrays.
  
  @param value
  The Java object to be written
  @throws JMSException
  If the JMS provider fails to write the message due to some
  internal error.
  @throws MessageNotWriteableException
  If the message is in read-only mode.
  @throws MessageFormatException
  If the object is of an invalid type.
  @throws NullPointerException
  If the object is null.