Package com.google.gwt.user.client.rpc.impl

Examples of com.google.gwt.user.client.rpc.impl.ClientSerializationStreamReader


  @SuppressWarnings("unchecked")
  public <T extends Serializable> T parse(String message) throws SerializationException {
    if (getMode() == SerialMode.RPC) {
      try {
        Serializer serializer = getSerializer();
        ClientSerializationStreamReader reader = new ClientSerializationStreamReader(serializer);
        reader.prepareToRead(message);
        return (T) reader.readObject();
      }
      catch (RuntimeException e) {
        throw new SerializationException(e);
      }
    }
    else if (getMode() == SerialMode.DE_RPC) {
      try {
        SerializationStreamReader reader = ClientWriterFactory.createReader(message);
        return (T) reader.readObject();
      }
      catch (RuntimeException e) {
        throw new SerializationException(e);
      }
    } else if (getMode() == SerialMode.PLAIN) {
View Full Code Here


    }

    public Object deserialize(String serialized) {

        ClientSerializationStreamReader c;
        Log.debug("Try to deserialize: " + serialized);
        try {
            c = getBootstrapService().createStreamReader(serialized);

            Object o = c.readObject();
            return o;
        } catch (SerializationException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

        // create the objects
        List<Object> objects = new ArrayList<Object>(messages.size());
        for (String message : messages) {
            try {
                Serializer serializer = getRPCSerializer();
                ClientSerializationStreamReader reader = new ClientSerializationStreamReader(serializer);
                reader.prepareToRead(message);
                objects.add(reader.readObject());
            } catch (RuntimeException e) {
                throw new SerializationException(e);
            }
        }
View Full Code Here

     *            The encoded string to read.
     * @return A new object stream reader.
     */
    public SerializationStreamReader createStreamReader(String encoded)
            throws SerializationException {
        ClientSerializationStreamReader clientSerializationStreamReader = new ClientSerializationStreamReader(
                serializer);

        if (encoded.startsWith("//OK") || encoded.startsWith("//EX")) {
            encoded = encoded.substring(4);
        }

        clientSerializationStreamReader.prepareToRead(encoded);
        return clientSerializationStreamReader;
    }
View Full Code Here

  @SuppressWarnings("unchecked")
  public <T extends Serializable> T parse(String message) throws SerializationException {
    if (getMode() == SerialMode.RPC) {
      try {
        Serializer serializer = getSerializer();
        ClientSerializationStreamReader reader = new ClientSerializationStreamReader(serializer);
        reader.prepareToRead(message);
        return (T) reader.readObject();
      }
      catch (RuntimeException e) {
        throw new SerializationException(e);
      }
    }
    else {
      try {
        SerializationStreamReader reader = ClientWriterFactory.createReader(message);
        return (T) reader.readObject();
      }
      catch (RuntimeException e) {
        throw new SerializationException(e);
      }
    }
View Full Code Here

    }

    final HasSerializer serializerHost = (HasSerializer) proxy;
    final Serializer serializer = serializerHost.getSerializer();

    final ClientSerializationStreamReader deserializer = new ClientSerializationStreamReader(serializer);
    deserializer.prepareToRead(serializedForm);
    return deserializer;
  }
View Full Code Here

    log(GWT, "Starting timing...");
    final long start = System.currentTimeMillis();
    Tree reconstituted = null;

    for (int i = 0; i < iterations; i++) {
      final ClientSerializationStreamReader reader = new ClientSerializationStreamReader(serializer);
      reader.prepareToRead(serverEncodedResponse);
      reconstituted = (Tree) reader.readObject();
    }
    final long end = System.currentTimeMillis();

    assertEquals("comparing original and reconsituted", tree, reconstituted);
View Full Code Here

    log(GWT, "Start timing...");
    final long start = System.currentTimeMillis();

    for (int i = 0; i < iterations; i++) {
      final ClientSerializationStreamReader reader = new ClientSerializationStreamReader(serializer);
      reader.prepareToRead(serverEncodedResponse);
      reconstituted = reader.readObject();
    }
    final long end = System.currentTimeMillis();

    log(GWT, "End of timing.");
    logBenchmark(GWT, DESERIALIZATION, iterations, start, end);
View Full Code Here

TOP

Related Classes of com.google.gwt.user.client.rpc.impl.ClientSerializationStreamReader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.