List of usage examples for com.google.gwt.user.client.rpc.impl ClientSerializationStreamReader readObject
public Object readObject() throws SerializationException
From source file:com.apress.progwt.client.GWTApp.java
License:Apache License
public Object deserialize(String serialized) { ClientSerializationStreamReader c; Log.debug("Try to deserialize: " + serialized); try {// w ww .ja v a 2 s. c o m c = getBootstrapService().createStreamReader(serialized); Object o = c.readObject(); return o; } catch (SerializationException e) { throw new RuntimeException(e); } }
From source file:de.csenk.gwt.ws.client.filter.serialization.ClientGWTSerializer.java
License:Open Source License
@Override public Object deserialize(String serializedContent) throws SerializationException { ClientSerializationStreamReader streamReader = new ClientSerializationStreamReader(serializer); streamReader.prepareToRead(serializedContent); String className = streamReader.readString(); if (className.equals("java.lang.String")) { return streamReader.readString(); } else {//from w ww . j a va2 s. c om return streamReader.readObject(); } }
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 {//from ww w . j a va 2s . c om 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.extensions.gwtwrapper.client.GwtClientSerializer.java
License:Apache License
public Object deserialize(String message) throws SerializationException { try {/* w ww . j a va 2 s .c o m*/ Serializer serializer = getRPCSerializer(); ClientSerializationStreamReader reader = new ClientSerializationStreamReader(serializer); reader.prepareToRead(message); return 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 {//from w w w. ja v a2 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"); } }
From source file:org.atmosphere.gwt20.client.GwtRpcClientSerializer.java
License:Apache License
public Object deserialize(String raw) throws SerializationException { buffer.append(raw);/*from www . ja v a 2 s . c o m*/ // split up in different parts - based on the [] // this is necessary because multiple objects can be chunked in one single string int brackets = 0; int start = 0; List<String> messages = new ArrayList<String>(); int bufSize = buffer.length(); for (int i = 0; i < bufSize; i++) { // detect brackets if (buffer.charAt(i) == '[') { // account for arrays which use [ as the leading part of the type encoding final int nextIndex = i + 1; if (nextIndex < bufSize) { final char nextChar = buffer.charAt(nextIndex); if (nextChar != 'L' && nextChar != 'B' && nextChar != 'C' && nextChar != 'S' && nextChar != 'I' && nextChar != 'J' && nextChar != 'F' && nextChar != 'D' && nextChar != 'Z') { ++brackets; } } else { ++brackets; } } else if (buffer.charAt(i) == ']') { --brackets; } // new message if (brackets == 0) { messages.add(buffer.substring(start, i + 1)); start = i + 1; } } buffer.delete(0, start); // create the objects List<Object> objects = new ArrayList<Object>(); 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); } } return objects; }