/** * @return a new object instance */ public DataStructure createObject() { return new ActiveMQStreamMessage(); }
private void initializeReading() throws MessageNotReadableException { checkWriteOnlyBody(); if (this.dataIn == null) { ByteSequence data = getContent(); if (data == null) { data = new ByteSequence(new byte[] {}, 0, 0); } InputStream is = new ByteArrayInputStream(data); if (isCompressed()) { is = new InflaterInputStream(is); is = new BufferedInputStream(is); } this.dataIn = new DataInputStream(is); } }
@Override public Message copy() { ActiveMQStreamMessage copy = new ActiveMQStreamMessage(); copy(copy); return copy; }
initializeWriting(); if (value == null) { try { writeString(value.toString()); } else if (value instanceof Character) { writeChar(((Character)value).charValue()); } else if (value instanceof Boolean) { writeBoolean(((Boolean)value).booleanValue()); } else if (value instanceof Byte) { writeByte(((Byte)value).byteValue()); } else if (value instanceof Short) { writeShort(((Short)value).shortValue()); } else if (value instanceof Integer) { writeInt(((Integer)value).intValue()); } else if (value instanceof Float) { writeFloat(((Float)value).floatValue()); } else if (value instanceof Double) { writeDouble(((Double)value).doubleValue()); } else if (value instanceof byte[]) { writeBytes((byte[])value); }else if (value instanceof Long) { writeLong(((Long)value).longValue()); }else { throw new MessageFormatException("Unsupported Object type: " + value.getClass());
StreamMessage streamMessage = (StreamMessage)message; streamMessage.reset(); ActiveMQStreamMessage msg = new ActiveMQStreamMessage(); msg.setConnection(connection); Object obj = null; msg.writeObject(obj);
/** * Writes a <code>byte</code> to the stream message. * * @param value the <code>byte</code> value 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. */ @Override public void writeByte(byte value) throws JMSException { initializeWriting(); try { MarshallingSupport.marshalByte(dataOut, value); } catch (IOException ioe) { throw JMSExceptionSupport.create(ioe); } }
private void initializeWriting() throws JMSException { checkReadOnlyBody(); if (this.dataOut == null) { this.bytesOut = new ByteArrayOutputStream(); OutputStream os = bytesOut; ActiveMQConnection connection = getConnection(); if (connection != null && connection.isUseCompression()) { compressed = true;
StreamMessage streamMessage = (StreamMessage)message; streamMessage.reset(); ActiveMQStreamMessage msg = new ActiveMQStreamMessage(); msg.setConnection(connection); Object obj = null; msg.writeObject(obj);
/** * Writes a <code>short</code> to the stream message. * * @param value the <code>short</code> value 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. */ @Override public void writeShort(short value) throws JMSException { initializeWriting(); try { MarshallingSupport.marshalShort(dataOut, value); } catch (IOException ioe) { throw JMSExceptionSupport.create(ioe); } }
private void initializeWriting() throws MessageNotWriteableException { checkReadOnlyBody(); if (this.dataOut == null) { this.bytesOut = new ByteArrayOutputStream(); OutputStream os = bytesOut; ActiveMQConnection connection = getConnection(); if (connection != null && connection.isUseCompression()) { compressed = true; os = new DeflaterOutputStream(os); } this.dataOut = new DataOutputStream(os); } }
StreamMessage streamMessage = (StreamMessage)message; streamMessage.reset(); ActiveMQStreamMessage msg = new ActiveMQStreamMessage(); msg.setConnection(connection); Object obj = null; msg.writeObject(obj);
/** * @return a new object instance */ public DataStructure createObject() { return new ActiveMQStreamMessage(); }
private void initializeReading() throws MessageNotReadableException { checkWriteOnlyBody(); if (this.dataIn == null) { ByteSequence data = getContent(); if (data == null) { data = new ByteSequence(new byte[] {}, 0, 0); } InputStream is = new ByteArrayInputStream(data); if (isCompressed()) { is = new InflaterInputStream(is); is = new BufferedInputStream(is); } this.dataIn = new DataInputStream(is); } }
@Override public Message copy() { ActiveMQStreamMessage copy = new ActiveMQStreamMessage(); copy(copy); return copy; }
initializeReading(); try { this.dataIn.mark(65);
/** * Writes a <code>double</code> to the stream message. * * @param value the <code>double</code> value 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. */ @Override public void writeDouble(double value) throws JMSException { initializeWriting(); try { MarshallingSupport.marshalDouble(dataOut, value); } catch (IOException ioe) { throw JMSExceptionSupport.create(ioe); } }
private void initializeWriting() throws JMSException { checkReadOnlyBody(); if (this.dataOut == null) { this.bytesOut = new ByteArrayOutputStream(); OutputStream os = bytesOut; ActiveMQConnection connection = getConnection(); if (connection != null && connection.isUseCompression()) { compressed = true;
StreamMessage streamMessage = (StreamMessage)message; streamMessage.reset(); ActiveMQStreamMessage msg = new ActiveMQStreamMessage(); msg.setConnection(connection); Object obj = null; msg.writeObject(obj);