public static void marshalString(DataOutputStream out, String s) throws IOException { // If it's too big, out.writeUTF may not able able to write it out. if (s.length() < Short.MAX_VALUE / 4) { out.writeByte(STRING_TYPE); out.writeUTF(s); } else { out.writeByte(BIG_STRING_TYPE); writeUTF8(out, s); } }
@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 static void marshalString(DataOutputStream out, String s) throws IOException { // If it's too big, out.writeUTF may not able able to write it out. if (s.length() < Short.MAX_VALUE / 4) { out.writeByte(STRING_TYPE); out.writeUTF(s); } else { out.writeByte(BIG_STRING_TYPE); writeUTF8(out, s); } }
public static void marshalString(DataOutputStream out, String s) throws IOException { // If it's too big, out.writeUTF may not able able to write it out. if (s.length() < Short.MAX_VALUE / 4) { out.writeByte(STRING_TYPE); out.writeUTF(s); } else { out.writeByte(BIG_STRING_TYPE); writeUTF8(out, s); } }
public static void marshalString(DataOutputStream out, String s) throws IOException { // If it's too big, out.writeUTF may not able able to write it out. if (s.length() < Short.MAX_VALUE / 4) { out.writeByte(STRING_TYPE); out.writeUTF(s); } else { out.writeByte(BIG_STRING_TYPE); writeUTF8(out, s); } }
public static void marshalString(DataOutputStream out, String s) throws IOException { // If it's too big, out.writeUTF may not able able to write it out. if (s.length() < Short.MAX_VALUE / 4) { out.writeByte(STRING_TYPE); out.writeUTF(s); } else { out.writeByte(BIG_STRING_TYPE); writeUTF8(out, s); } }
private static byte[] toAMQMessageTextType(final ActiveMQBuffer buffer, final boolean isCompressed) throws IOException { byte[] bytes = null; SimpleString text = buffer.readNullableSimpleString(); if (text != null) { ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(text.length() + 4); OutputStream out = bytesOut; if (isCompressed) { out = new DeflaterOutputStream(out, true); } try (DataOutputStream dataOut = new DataOutputStream(out)) { MarshallingSupport.writeUTF8(dataOut, text.toString()); dataOut.flush(); bytes = bytesOut.toByteArray(); } } return bytes; }
@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); } }
@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()); } }