Example usage for com.google.gwt.user.client.rpc.impl AbstractSerializationStream SERIALIZATION_STREAM_VERSION

List of usage examples for com.google.gwt.user.client.rpc.impl AbstractSerializationStream SERIALIZATION_STREAM_VERSION

Introduction

In this page you can find the example usage for com.google.gwt.user.client.rpc.impl AbstractSerializationStream SERIALIZATION_STREAM_VERSION.

Prototype

int SERIALIZATION_STREAM_VERSION

To view the source code for com.google.gwt.user.client.rpc.impl AbstractSerializationStream SERIALIZATION_STREAM_VERSION.

Click Source Link

Document

The current RPC protocol version.

Usage

From source file:org.restlet.ext.gwt.ObjectRepresentation.java

License:LGPL

/**
 * The wrapped object. Triggers the deserialization if necessary.
 * //  www  . ja  v a  2s  .  co m
 * @return The wrapped object.
 * @throws IOException
 */
@SuppressWarnings("unchecked")
public T getObject() throws IOException {
    if ((this.object == null) && (getText() != null)) {
        try {
            ServerSerializationStreamReader objectReader = new ServerSerializationStreamReader(
                    Engine.getInstance().getClassLoader(), new SimpleSerializationPolicyProvider());
            String encodedString = getText();

            if (encodedString.indexOf('|') == -1) {
                encodedString = AbstractSerializationStream.SERIALIZATION_STREAM_VERSION + "|1|0|0|0|"
                        + getText() + '|';
            }

            objectReader.prepareToRead(encodedString);
            this.object = (T) objectReader.deserializeValue(this.targetClass);
        } catch (Exception e) {
            this.object = null;
            IOException ioe = new IOException("Couldn't read the GWT object representation: " + e.getMessage());
            ioe.initCause(e);
            throw ioe;
        }

    }

    return object;
}