public static void marshalString(DataByteArrayOutputStream 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); out.writeUTF(s); } }
public static void marshalString(DataByteArrayOutputStream 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); out.writeUTF(s); } }
public void encodeResponse(ClassLoader loader, Class<?> type, Object value, Throwable error, DataByteArrayOutputStream target) throws IOException, ClassNotFoundException { if( error!=null ) { target.writeBoolean(true); target.writeUTF(error.getClass().getName()); target.writeUTF(error.getMessage()); } else { target.writeBoolean(false); encodeProtobuf(type, value, target); } }
public void encodeResponse(ClassLoader loader, Class<?> type, Object value, Throwable error, DataByteArrayOutputStream target) throws IOException, ClassNotFoundException { if( error!=null ) { target.writeBoolean(true); target.writeUTF(error.getClass().getName()); target.writeUTF(error.getMessage()); } else { target.writeBoolean(false); encodeProtobuf(type, value, target); } }
public static void marshalPrimitiveMap(Map map, DataByteArrayOutputStream out) throws IOException { if (map == null) { out.writeInt(-1); } else { out.writeInt(map.size()); for (Iterator iter = map.keySet().iterator(); iter.hasNext();) { String name = (String) iter.next(); out.writeUTF(name); Object value = map.get(name); marshalPrimitive(out, value); } } }
public static void marshalPrimitiveMap(Map map, DataByteArrayOutputStream out) throws IOException { if (map == null) { out.writeInt(-1); } else { out.writeInt(map.size()); for (Iterator iter = map.keySet().iterator(); iter.hasNext();) { String name = (String) iter.next(); out.writeUTF(name); Object value = map.get(name); marshalPrimitive(out, value); } } }
/** * Writes a string to the bytes message stream using UTF-8 encoding in a * machine-independent manner. * <p/> * For more information on the UTF-8 format, see "File System Safe UCS * Transformation Format (FSS_UTF)", X/Open Preliminary Specification, * X/Open Company Ltd., Document Number: P316. This information also appears * in ISO/IEC 10646, Annex P. * * @param value the <code>String</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. */ public void writeUTF(String value) throws JMSException { initializeWriting(); try { this.bytesOut.writeUTF(value); } catch (IOException ioe) { throw StompJmsExceptionSupport.create(ioe); } }
/** * Writes a string to the bytes message stream using UTF-8 encoding in a * machine-independent manner. * <p/> * For more information on the UTF-8 format, see "File System Safe UCS * Transformation Format (FSS_UTF)", X/Open Preliminary Specification, * X/Open Company Ltd., Document Number: P316. This information also appears * in ISO/IEC 10646, Annex P. * * @param value the <code>String</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. */ public void writeUTF(String value) throws JMSException { initializeWriting(); try { this.bytesOut.writeUTF(value); } catch (IOException ioe) { throw StompJmsExceptionSupport.create(ioe); } }