@Override public <T> T deserialize(byte[] bytes, Class<T> clazz) { try { TBase instance = (TBase) clazz.newInstance(); new TDeserializer().deserialize(instance, bytes); return (T) instance; } catch (Exception e) { throw new RuntimeException(e); } } }
public static <T> T thriftDeserialize(Class<T> c, byte[] b, int offset, int length) { try { T ret = c.newInstance(); TDeserializer des = getDes(); des.deserialize((TBase) ret, b, offset, length); return ret; } catch (Exception e) { throw new RuntimeException(e); } }
@Override public <T> T deserialize(byte[] bytes, Class<T> clazz) { try { TBase instance = (TBase) clazz.newInstance(); new TDeserializer().deserialize(instance, Utils.gunzip(bytes)); return (T) instance; } catch (Exception e) { throw new RuntimeException(e); } } }
private TBase deserialize(ThriftSerializedObject obj, TDeserializer td) { try { Class<?> clazz; try { clazz = Class.forName(obj.get_name()); } catch (ClassNotFoundException ex) { //Try to maintain rolling upgrade compatible with 0.10 releases clazz = Class.forName(obj.get_name().replaceAll("^backtype\\.storm\\.", "org.apache.storm.")); } TBase instance = (TBase) clazz.newInstance(); td.deserialize(instance, obj.get_bits()); return instance; } catch (Exception e) { throw new RuntimeException(e); } }
private Map<String, ThriftSerializedObject> partialDeserializeLatestVersion(TDeserializer td) { try { String latestPath = _vs.mostRecentVersionPath(); Map<String, ThriftSerializedObject> result = new HashMap<>(); if (latestPath != null) { byte[] serialized = FileUtils.readFileToByteArray(new File(latestPath)); if (serialized.length == 0) { LOG.warn("LocalState file '{}' contained no data, resetting state", latestPath); } else { if (td == null) { td = new TDeserializer(); } LocalStateData data = new LocalStateData(); td.deserialize(data, serialized); result = data.get_serialized_parts(); } } return result; } catch (Exception e) { throw new RuntimeException(e); } }
public static <T> T thriftDeserialize(Class<T> c, byte[] b, int offset, int length) { try { T ret = c.newInstance(); TDeserializer des = getDes(); des.deserialize((TBase) ret, b, offset, length); return ret; } catch (Exception e) { throw new RuntimeException(e); } }
@Override public <T> T deserialize(byte[] bytes, Class<T> clazz) { try { TBase instance = (TBase) clazz.newInstance(); new TDeserializer().deserialize(instance, bytes); return (T)instance; } catch (Exception e) { throw new RuntimeException(e); } } }
private TBase deserialize(ThriftSerializedObject obj, TDeserializer td) { try { Class<?> clazz = Class.forName(obj.get_name()); TBase instance = (TBase) clazz.newInstance(); td.deserialize(instance, obj.get_bits()); return instance; } catch(Exception e) { throw new RuntimeException(e); } }
@Override public <T> T deserialize(byte[] bytes, Class<T> clazz) { try { TBase instance = (TBase) clazz.newInstance(); new TDeserializer().deserialize(instance, Utils.gunzip(bytes)); return (T)instance; } catch (Exception e) { throw new RuntimeException(e); } } }
private Map<String, ThriftSerializedObject> partialDeserializeLatestVersion(TDeserializer td) { try { String latestPath = _vs.mostRecentVersionPath(); Map<String, ThriftSerializedObject> result = new HashMap<>(); if (latestPath != null) { byte[] serialized = FileUtils.readFileToByteArray(new File(latestPath)); if (serialized.length == 0) { LOG.warn("LocalState file '{}' contained no data, resetting state", latestPath); } else { if (td == null) { td = new TDeserializer(); } LocalStateData data = new LocalStateData(); td.deserialize(data, serialized); result = data.get_serialized_parts(); } } return result; } catch(Exception e) { throw new RuntimeException(e); } }