@Override public SerializationStreamReader createStreamReader(String encoded) throws SerializationException { ClientSerializationStreamReader clientSerializationStreamReader = new ClientSerializationStreamReader(this.serializer); String encodedResponse = encoded; if (encoded.startsWith("//OK") || encodedResponse.startsWith("//EX")) { encodedResponse = encodedResponse.substring(4); } clientSerializationStreamReader.prepareToRead(encodedResponse); return clientSerializationStreamReader; }
@Override @SuppressWarnings("unchecked") public <T> T deserialize(Class<? super T> clazz, String serializedString) throws SerializationException { if (serializedString == null) { return null; }else if(String.class.equals(clazz)){ return (T) serializedString; } ClientSerializationStreamReader reader = new ClientSerializationStreamReader(TYPE_SERIALIZER); reader.prepareToRead(serializedString); Object obj = findType(clazz).read(reader); return obj != null ? (T) obj : null; }