Object read(ServerSerializationStreamReader stream, BoundedList<Object> instance, Type expectedType, DequeMap<TypeVariable<?>, Type> resolvedTypes) throws SerializationException { for (int i = 0, n = instance.getExpectedSize(); i < n; ++i) { instance.add(readSingleValue(stream, expectedType, resolvedTypes)); } return toArray(instance.getComponentType(), instance); } }
private void writeStringTable(LengthConstrainedArray stream) { LengthConstrainedArray tableStream = new LengthConstrainedArray(); for (String s : getStringTable()) { tableStream.addEscapedToken(s); } stream.addToken(tableStream.toString()); stream.setJavaScript(stream.isJavaScript() || tableStream.isJavaScript()); } }
/** * 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 protected Object readSingleValue(ServerSerializationStreamReader stream) throws SerializationException { return stream.readObject(); }
@Override void write(ServerSerializationStreamWriter stream, Object instance) throws SerializationException { stream.writeObject(instance); } },
@Override void write(ServerSerializationStreamWriter stream, Object instance) { boolean[] vector = (boolean[]) instance; stream.writeInt(vector.length); for (int i = 0, n = vector.length; i < n; ++i) { stream.writeBoolean(vector[i]); } } },
@Override void write(ServerSerializationStreamWriter stream, Object instance) { float[] vector = (float[]) instance; stream.writeInt(vector.length); for (int i = 0, n = vector.length; i < n; ++i) { stream.writeFloat(vector[i]); } } },
@Override Object readValue(ServerSerializationStreamReader stream) throws SerializationException { return stream.readString(); } };
@Override protected Object readSingleValue(ServerSerializationStreamReader stream) throws SerializationException { return stream.readChar(); }
/** * Returns a default serialization policy. * * @return the default serialization policy. */ public static SerializationPolicy getDefaultSerializationPolicy() { return LegacySerializationPolicy.getInstance(); }
@Override Object readValue(ServerSerializationStreamReader stream) throws SerializationException { return stream.readFloat(); } },
/** * Remove all of the actual types that arose from the given type. * * This method should always be called after a corresponding call to * resolveTypes. * * @param methodType The type we wish to assign this instance to * @param resolvedTypes The types that have been resolved to actual values */ public static void releaseTypes(Type methodType, DequeMap<TypeVariable<?>, Type> resolvedTypes) { SerializabilityUtil.resolveTypesWorker(methodType, resolvedTypes, false); }
/** * This method takes a string and outputs a JavaScript string literal. The * data is surrounded with quotes, and any contained characters that need to * be escaped are mapped onto their escape sequence. * * Assumptions: We are targeting a version of JavaScript that that is later * than 1.3 that supports unicode strings. */ public static String escapeString(String toEscape) { return escapeString(toEscape, false, null); }
@Override protected Object readSingleValue(ServerSerializationStreamReader stream) throws SerializationException { return stream.readByte(); }
@Override protected Object readSingleValue(ServerSerializationStreamReader stream) throws SerializationException { return stream.readLong(); }
@SuppressWarnings("unused") protected Object readSingleValue(ServerSerializationStreamReader stream, Type expectedType, DequeMap<TypeVariable<?>, Type> resolvedTypes) throws SerializationException { return readSingleValue(stream); }
Object read(ServerSerializationStreamReader stream, BoundedList<Object> instance) throws SerializationException { for (int i = 0, n = instance.getExpectedSize(); i < n; ++i) { instance.add(readSingleValue(stream)); } return toArray(instance.getComponentType(), instance); }
@Override Object readValue(ServerSerializationStreamReader stream, Type expectedType, DequeMap<TypeVariable<?>, Type> resolvedTypes) throws SerializationException { return stream.readObject(expectedType, resolvedTypes); } },
@Override Object readValue(ServerSerializationStreamReader stream) throws SerializationException { return stream.readChar(); } },
public static void deserialize(ServerSerializationStreamReader streamReader, Object[] instance, Type[] expectedParameterTypes, DequeMap<TypeVariable<?>, Type> resolvedTypes) throws SerializationException { for (int itemIndex = 0; itemIndex < instance.length; ++itemIndex) { instance[itemIndex] = streamReader.readObject(expectedParameterTypes[0], resolvedTypes); } }