List of usage examples for com.google.gwt.rpc.client.impl ClientWriterFactory createReader
public static SerializationStreamReader createReader(String payload) throws IncompatibleRemoteServiceException, RemoteException
From source file:net.zschech.gwt.comet.client.CometSerializer.java
License:Apache License
@SuppressWarnings("unchecked") public <T extends Serializable> T parse(String message) throws SerializationException { if (getMode() == SerialMode.RPC) { try {/*w w w . j a v a 2 s . com*/ 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); } } }
From source file:org.atmosphere.gwt.client.AtmosphereGWTSerializer.java
License:Apache License
@SuppressWarnings("unchecked") public <T extends Serializable> T parse(String message) throws SerializationException { if (getMode() == SerialMode.RPC) { try {/* ww w . j a v a 2 s . co m*/ 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) { return (T) message; } else { throw new UnsupportedOperationException("Not implemented yet"); } }