@Override public void writeDouble(double fieldValue) { if (getVersion() >= SERIALIZATION_STREAM_JSON_VERSION && (Double.isNaN(fieldValue) || Double.isInfinite(fieldValue))) { append('"' + String.valueOf(fieldValue) + '"'); } else { super.writeDouble(fieldValue); } }
/** * Notice that the field are written in reverse order that the client can just * pop items out of the stream. */ private void writeHeader(LengthConstrainedArray stream) { stream.addToken(getFlags()); if (stream.isJavaScript() && getVersion() >= SERIALIZATION_STREAM_JSON_VERSION) { // Ensure we are not using the JSON supported version if stream is Javascript instead of JSON stream.addToken(SERIALIZATION_STREAM_JSON_VERSION - 1); } else { stream.addToken(getVersion()); } }
@Override public void writeLong(long value) { if (getVersion() == SERIALIZATION_STREAM_MIN_VERSION) { // Write longs as a pair of doubles for backwards compatibility double[] parts = getAsDoubleArray(value); assert parts != null && parts.length == 2; writeDouble(parts[0]); writeDouble(parts[1]); } else { StringBuilder sb = new StringBuilder(); sb.append('"'); sb.append(Base64Utils.toBase64(value)); sb.append('"'); append(sb.toString()); } }
@Override public void writeDouble(double fieldValue) { if (getVersion() >= SERIALIZATION_STREAM_JSON_VERSION && (Double.isNaN(fieldValue) || Double.isInfinite(fieldValue))) { append('"' + String.valueOf(fieldValue) + '"'); } else { super.writeDouble(fieldValue); } }
@Override public void writeDouble(double fieldValue) { if (getVersion() >= SERIALIZATION_STREAM_JSON_VERSION && (Double.isNaN(fieldValue) || Double.isInfinite(fieldValue))) { append('"' + String.valueOf(fieldValue) + '"'); } else { super.writeDouble(fieldValue); } }
@Override public void writeLong(long value) { if (getVersion() == SERIALIZATION_STREAM_MIN_VERSION) { // Write longs as a pair of doubles for backwards compatibility double[] parts = getAsDoubleArray(value); assert parts != null && parts.length == 2; writeDouble(parts[0]); writeDouble(parts[1]); } else { StringBuilder sb = new StringBuilder(); sb.append('"'); sb.append(Base64Utils.toBase64(value)); sb.append('"'); append(sb.toString()); } }
@Override public void writeLong(long value) { if (getVersion() == SERIALIZATION_STREAM_MIN_VERSION) { // Write longs as a pair of doubles for backwards compatibility double[] parts = getAsDoubleArray(value); assert parts != null && parts.length == 2; writeDouble(parts[0]); writeDouble(parts[1]); } else { StringBuilder sb = new StringBuilder(); sb.append('"'); sb.append(Base64Utils.toBase64(value)); sb.append('"'); append(sb.toString()); } }
/** * Notice that the field are written in reverse order that the client can just * pop items out of the stream. */ private void writeHeader(LengthConstrainedArray stream) { stream.addToken(getFlags()); if (stream.isJavaScript() && getVersion() >= SERIALIZATION_STREAM_JSON_VERSION) { // Ensure we are not using the JSON supported version if stream is Javascript instead of JSON stream.addToken(SERIALIZATION_STREAM_JSON_VERSION - 1); } else { stream.addToken(getVersion()); } }
/** * Notice that the field are written in reverse order that the client can just * pop items out of the stream. */ private void writeHeader(LengthConstrainedArray stream) { stream.addToken(getFlags()); if (stream.isJavaScript() && getVersion() >= SERIALIZATION_STREAM_JSON_VERSION) { // Ensure we are not using the JSON supported version if stream is Javascript instead of JSON stream.addToken(SERIALIZATION_STREAM_JSON_VERSION - 1); } else { stream.addToken(getVersion()); } }