@Override public void storeContent() { ByteSequence bodyAsBytes = getContent(); if (bodyAsBytes == null && object != null) { try { ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); OutputStream os = bytesOut; ActiveMQConnection connection = getConnection(); if (connection != null && connection.isUseCompression()) { compressed = true; os = new DeflaterOutputStream(os); } DataOutputStream dataOut = new DataOutputStream(os); ObjectOutputStream objOut = new ObjectOutputStream(dataOut); objOut.writeObject(object); objOut.flush(); objOut.reset(); objOut.close(); setContent(bytesOut.toByteSequence()); } catch (IOException ioe) { throw new RuntimeException(ioe.getMessage(), ioe); } } }
@Override public void storeContent() { try { if (getContent() == null && !map.isEmpty()) { ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); OutputStream os = bytesOut; ActiveMQConnection connection = getConnection(); if (connection != null && connection.isUseCompression()) { compressed = true; os = new DeflaterOutputStream(os); } DataOutputStream dataOut = new DataOutputStream(os); MarshallingSupport.marshalPrimitiveMap(map, dataOut); dataOut.close(); setContent(bytesOut.toByteSequence()); } } catch (IOException e) { throw new RuntimeException(e); } }
@Override public void storeContent() { try { ByteSequence content = getContent(); String text = this.text; if (content == null && text != null) { ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); OutputStream os = bytesOut; ActiveMQConnection connection = getConnection(); if (connection != null && connection.isUseCompression()) { compressed = true; os = new DeflaterOutputStream(os); } DataOutputStream dataOut = new DataOutputStream(os); MarshallingSupport.writeUTF8(dataOut, text); dataOut.close(); setContent(bytesOut.toByteSequence()); } } catch (IOException e) { throw new RuntimeException(e); } }
@Override public void storeContent() { if (dataOut != null) { try { dataOut.close(); ByteSequence bs = bytesOut.toByteSequence(); setContent(bs); ActiveMQConnection connection = getConnection(); if (connection != null && connection.isUseCompression()) { doCompress(); } } catch (IOException ioe) { throw new RuntimeException(ioe.getMessage(), ioe); } finally { try { if (bytesOut != null) { bytesOut.close(); bytesOut = null; } if (dataOut != null) { dataOut.close(); dataOut = null; } } catch (IOException ioe) { } } } }
OutputStream os = bytesOut; ActiveMQConnection connection = getConnection(); if (connection != null && connection.isUseCompression()) { compressed = true; os = new DeflaterOutputStream(os);
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); } }
@Override public void storeContent() { ByteSequence bodyAsBytes = getContent(); if (bodyAsBytes == null && object != null) { try { ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); OutputStream os = bytesOut; ActiveMQConnection connection = getConnection(); if (connection != null && connection.isUseCompression()) { compressed = true; os = new DeflaterOutputStream(os); } DataOutputStream dataOut = new DataOutputStream(os); ObjectOutputStream objOut = new ObjectOutputStream(dataOut); objOut.writeObject(object); objOut.flush(); objOut.reset(); objOut.close(); setContent(bytesOut.toByteSequence()); } catch (IOException ioe) { throw new RuntimeException(ioe.getMessage(), ioe); } } }
@Override public void storeContent() { ByteSequence bodyAsBytes = getContent(); if (bodyAsBytes == null && object != null) { try { ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); OutputStream os = bytesOut; ActiveMQConnection connection = getConnection(); if (connection != null && connection.isUseCompression()) { compressed = true; os = new DeflaterOutputStream(os); } DataOutputStream dataOut = new DataOutputStream(os); ObjectOutputStream objOut = new ObjectOutputStream(dataOut); objOut.writeObject(object); objOut.flush(); objOut.reset(); objOut.close(); setContent(bytesOut.toByteSequence()); } catch (IOException ioe) { throw new RuntimeException(ioe.getMessage(), ioe); } } }
private void storeContent() { try { if (getContent() == null && !map.isEmpty()) { ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); OutputStream os = bytesOut; ActiveMQConnection connection = getConnection(); if (connection != null && connection.isUseCompression()) { compressed = true; os = new DeflaterOutputStream(os); } DataOutputStream dataOut = new DataOutputStream(os); MarshallingSupport.marshalPrimitiveMap(map, dataOut); dataOut.close(); setContent(bytesOut.toByteSequence()); } } catch (IOException e) { throw new RuntimeException(e); } }
@Override public void storeContent() { ByteSequence bodyAsBytes = getContent(); if (bodyAsBytes == null && object != null) { try { ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); OutputStream os = bytesOut; ActiveMQConnection connection = getConnection(); if (connection != null && connection.isUseCompression()) { compressed = true; os = new DeflaterOutputStream(os); } DataOutputStream dataOut = new DataOutputStream(os); ObjectOutputStream objOut = new ObjectOutputStream(dataOut); objOut.writeObject(object); objOut.flush(); objOut.reset(); objOut.close(); setContent(bytesOut.toByteSequence()); } catch (IOException ioe) { throw new RuntimeException(ioe.getMessage(), ioe); } } }
@Override public void storeContent() { try { if (getContent() == null && !map.isEmpty()) { ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); OutputStream os = bytesOut; ActiveMQConnection connection = getConnection(); if (connection != null && connection.isUseCompression()) { compressed = true; os = new DeflaterOutputStream(os); } DataOutputStream dataOut = new DataOutputStream(os); MarshallingSupport.marshalPrimitiveMap(map, dataOut); dataOut.close(); setContent(bytesOut.toByteSequence()); } } catch (IOException e) { throw new RuntimeException(e); } }
@Override public void storeContent() { try { if (getContent() == null && !map.isEmpty()) { ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); OutputStream os = bytesOut; ActiveMQConnection connection = getConnection(); if (connection != null && connection.isUseCompression()) { compressed = true; os = new DeflaterOutputStream(os); } DataOutputStream dataOut = new DataOutputStream(os); MarshallingSupport.marshalPrimitiveMap(map, dataOut); dataOut.close(); setContent(bytesOut.toByteSequence()); } } catch (IOException e) { throw new RuntimeException(e); } }
@Override public void storeContent() { try { ByteSequence content = getContent(); String text = this.text; if (content == null && text != null) { ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); OutputStream os = bytesOut; ActiveMQConnection connection = getConnection(); if (connection != null && connection.isUseCompression()) { compressed = true; os = new DeflaterOutputStream(os); } DataOutputStream dataOut = new DataOutputStream(os); MarshallingSupport.writeUTF8(dataOut, text); dataOut.close(); setContent(bytesOut.toByteSequence()); } } catch (IOException e) { throw new RuntimeException(e); } }
@Override public void storeContent() { try { if (getContent() == null && !map.isEmpty()) { ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); OutputStream os = bytesOut; ActiveMQConnection connection = getConnection(); if (connection != null && connection.isUseCompression()) { compressed = true; os = new DeflaterOutputStream(os); } DataOutputStream dataOut = new DataOutputStream(os); MarshallingSupport.marshalPrimitiveMap(map, dataOut); dataOut.close(); setContent(bytesOut.toByteSequence()); } } catch (IOException e) { throw new RuntimeException(e); } }
@Override public void storeContent() { if (dataOut != null) { try { dataOut.close(); ByteSequence bs = bytesOut.toByteSequence(); setContent(bs); ActiveMQConnection connection = getConnection(); if (connection != null && connection.isUseCompression()) { doCompress(); } } catch (IOException ioe) { throw new RuntimeException(ioe.getMessage(), ioe); } finally { try { if (bytesOut != null) { bytesOut.close(); bytesOut = null; } if (dataOut != null) { dataOut.close(); dataOut = null; } } catch (IOException ioe) { } } } }
@Override public void storeContent() { if (dataOut != null) { try { dataOut.close(); ByteSequence bs = bytesOut.toByteSequence(); setContent(bs); ActiveMQConnection connection = getConnection(); if (connection != null && connection.isUseCompression()) { doCompress(); } } catch (IOException ioe) { throw new RuntimeException(ioe.getMessage(), ioe); } finally { try { if (bytesOut != null) { bytesOut.close(); bytesOut = null; } if (dataOut != null) { dataOut.close(); dataOut = null; } } catch (IOException ioe) { } } } }
@Override public void storeContent() { try { ByteSequence content = getContent(); String text = this.text; if (content == null && text != null) { ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); OutputStream os = bytesOut; ActiveMQConnection connection = getConnection(); if (connection != null && connection.isUseCompression()) { compressed = true; os = new DeflaterOutputStream(os); } DataOutputStream dataOut = new DataOutputStream(os); MarshallingSupport.writeUTF8(dataOut, text); dataOut.close(); setContent(bytesOut.toByteSequence()); } } catch (IOException e) { throw new RuntimeException(e); } }
@Override public void storeContent() { try { ByteSequence content = getContent(); String text = this.text; if (content == null && text != null) { ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); OutputStream os = bytesOut; ActiveMQConnection connection = getConnection(); if (connection != null && connection.isUseCompression()) { compressed = true; os = new DeflaterOutputStream(os); } DataOutputStream dataOut = new DataOutputStream(os); MarshallingSupport.writeUTF8(dataOut, text); dataOut.close(); setContent(bytesOut.toByteSequence()); } } catch (IOException e) { throw new RuntimeException(e); } }
public void beforeMarshall(WireFormat wireFormat) throws IOException { super.beforeMarshall(wireFormat); ByteSequence content = getContent(); if (content == null && text != null) { ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); OutputStream os = bytesOut; ActiveMQConnection connection = getConnection(); if (connection != null && connection.isUseCompression()) { compressed = true; os = new DeflaterOutputStream(os); } DataOutputStream dataOut = new DataOutputStream(os); MarshallingSupport.writeUTF8(dataOut, this.text); dataOut.close(); setContent(bytesOut.toByteSequence()); } }
@Before @Override public void setUp() throws Exception { super.setUp(); connection.start(); assertTrue(connection.isUseCompression()); }