コード例 #1
0
 // This method is ONLY supposed to be used for object form of primitive types !
 @Override
 public void writeObject(Object obj) throws JMSException {
   if (readMode) throw new MessageNotWriteableException("Message not writable");
   try {
     // unrolling it
     if (obj instanceof Boolean) {
       writeOnlyMessage.writeBoolean((Boolean) obj);
     } else if (obj instanceof Byte) {
       writeOnlyMessage.writeByte((Byte) obj);
     } else if (obj instanceof Short) {
       writeOnlyMessage.writeShort((Short) obj);
     } else if (obj instanceof Character) {
       writeOnlyMessage.writeChar((Character) obj);
     } else if (obj instanceof Integer) {
       writeOnlyMessage.writeInt((Integer) obj);
     } else if (obj instanceof Long) {
       writeOnlyMessage.writeLong((Long) obj);
     } else if (obj instanceof Float) {
       writeOnlyMessage.writeFloat((Float) obj);
     } else if (obj instanceof Double) {
       writeOnlyMessage.writeDouble((Double) obj);
     } else if (obj instanceof String) {
       writeOnlyMessage.writeUTF((String) obj);
     } else if (obj instanceof byte[]) {
       writeOnlyMessage.writeBytes((byte[]) obj);
     } else {
       throw new JMSException("Unsupported type for obj : " + obj.getClass());
     }
   } catch (IOException ioEx) {
     MessageEOFException eofEx = new MessageEOFException("Unexpected ioex : " + ioEx);
     eofEx.setLinkedException(ioEx);
     throw eofEx;
   }
 }
コード例 #2
0
 @Override
 public void writeBytes(byte[] data, int offset, int length) throws JMSException {
   if (readMode) throw new MessageNotWriteableException("Message not writable");
   try {
     writeOnlyMessage.writeBytes(data, offset, length);
   } catch (IOException ioEx) {
     MessageEOFException eofEx = new MessageEOFException("Unexpected ioex : " + ioEx);
     eofEx.setLinkedException(ioEx);
     throw eofEx;
   }
 }
コード例 #3
0
 @Override
 public int readBytes(byte[] data, int length) throws JMSException {
   if (!readMode) throw new MessageNotReadableException("Message not readable");
   try {
     return readOnlyMessage.readBytes(data, length);
   } catch (IOException eof) {
     MessageEOFException eofEx = new MessageEOFException("eof ?");
     eofEx.setLinkedException(eof);
     throw eofEx;
   }
 }
コード例 #4
0
 @Override
 public void writeUTF(String val) throws JMSException {
   if (readMode) throw new MessageNotWriteableException("Message not writable");
   try {
     writeOnlyMessage.writeUTF(val);
   } catch (IOException ioEx) {
     MessageEOFException eofEx = new MessageEOFException("Unexpected ioex : " + ioEx);
     eofEx.setLinkedException(ioEx);
     throw eofEx;
   }
 }
コード例 #5
0
 @Override
 public String readUTF() throws JMSException {
   if (!readMode) throw new MessageNotReadableException("Message not readable");
   try {
     return readOnlyMessage.readUTF();
   } catch (IOException eof) {
     MessageEOFException eofEx = new MessageEOFException("eof ?");
     eofEx.setLinkedException(eof);
     throw eofEx;
   }
 }