@Override public Object deserialize(Writable field) throws SerDeException { Object obj = super.deserialize(field); try { ((TBase) obj).read(inProtocol); } catch (Exception e) { throw new SerDeException(e); } return obj; }
try { t = this._thriftClass.newInstance(); t.read(_binaryIn); } catch (Exception e) { throw new RuntimeException("Caught exception while serialize thrift instance", e);
public T toObject(byte[] bytes) { MemoryBuffer buffer = new MemoryBuffer(); try { buffer.write(bytes); } catch(TTransportException e) { throw new SerializationException(e); } TProtocol protocol = createThriftProtocol(buffer); T msg = null; try { msg = messageClass.newInstance(); msg.read(protocol); } catch(InstantiationException e) { throw new SerializationException(e); } catch(IllegalAccessException e) { throw new SerializationException(e); } catch(TException e) { throw new SerializationException(e); } return msg; }
args.read(inProto); inProto.readMessageEnd();
result.read(inputProtocol); inputProtocol.readMessageEnd();
/** * Deserializes a message into the provided {@code instance} from {@code serialized} * * @param serialized * The serialized representation of the object * @param instance * An instance of the object to reconstitute * @return The reconstituted instance provided * @throws IOException * When deserialization fails */ public <T extends TBase<?,?>> T deserialize(byte[] serialized, int offset, int length, T instance) throws IOException { requireNonNull(instance); TCompactProtocol proto = new TCompactProtocol( new TMemoryInputTransport(serialized, offset, length)); try { instance.read(proto); } catch (TException e) { throw new IOException(e); } return instance; } }
/** * Deserialize the Thrift object from a byte array. * * @param base The object to read into * @param bytes The array to read from * @param offset The offset into {@code bytes} * @param length The length to read from {@code bytes} */ public void deserialize(TBase base, byte[] bytes, int offset, int length) throws TException { try { trans_.reset(bytes, offset, length); base.read(protocol_); } finally { trans_.clear(); protocol_.reset(); } }
protected void receiveBase(TBase<?,?> result, String methodName) throws TException { TMessage msg = iprot_.readMessageBegin(); if (msg.type == TMessageType.EXCEPTION) { TApplicationException x = new TApplicationException(); x.read(iprot_); iprot_.readMessageEnd(); throw x; } if (msg.seqid != seqid_) { throw new TApplicationException(TApplicationException.BAD_SEQUENCE_ID, String.format("%s failed: out of sequence response: expected %d but got %d", methodName, seqid_, msg.seqid)); } result.read(iprot_); iprot_.readMessageEnd(); } }
/** * Deserialize only a single Thrift object (addressed by recursively using field id) * from a byte record. * @param tb The object to read into * @param bytes The serialized object to read from * @param fieldIdPathFirst First of the FieldId's that define a path tb * @param fieldIdPathRest The rest FieldId's that define a path tb * @throws TException */ public void partialDeserialize(TBase tb, byte[] bytes, TFieldIdEnum fieldIdPathFirst, TFieldIdEnum ... fieldIdPathRest) throws TException { try { if (locateField(bytes, fieldIdPathFirst, fieldIdPathRest) != null) { // if this line is reached, iprot will be positioned at the start of tb. tb.read(protocol_); } } catch (Exception e) { throw new TException(e); } finally { trans_.clear(); protocol_.reset(); } }
public final void process(int seqid, TProtocol iprot, TProtocol oprot, I iface) throws TException { T args = getEmptyArgsInstance(); try { args.read(iprot); } catch (TProtocolException e) { iprot.readMessageEnd();
public static <A extends TBase> A parseForm(A instance,InputStream in) throws Exception{ TIOStreamTransport sport = new TIOStreamTransport(in); TProtocol protocol = createTProtocol(sport); instance.read(protocol); return instance; } }
/** * Reads the next object from the fileName. */ public TBase read() throws IOException { TBase t = creator.create(); try { t.read(binaryIn); } catch (TException e) { throw new IOException(e); } return t; }
public static <A extends TBase> A parseForm(A instance,byte[] bytes) throws Exception{ TIOStreamTransport sport = new TIOStreamTransport(new ByteArrayInputStream(bytes)); TProtocol protocol = createTProtocol(sport); instance.read(protocol); return instance; }
/** * Deserialize the Thrift object from a byte array. * * @param base The object to read into * @param bytes The array to read from */ public void deserialize(TBase base, byte[] bytes) throws TException { base.read( protocolFactory_.getProtocol( new TIOStreamTransport( new ByteArrayInputStream(bytes)))); }
args.read(in); } catch (TProtocolException e) { in.readMessageEnd();
@Override public Object deserialize(Writable field) throws SerDeException { Object obj = super.deserialize(field); try { ((TBase) obj).read(inProtocol); } catch (Exception e) { throw new SerDeException(e); } return obj; }
@Override public Object deserialize(Writable field) throws SerDeException { Object obj = super.deserialize(field); try { ((TBase) obj).read(inProtocol); } catch (Exception e) { throw new SerDeException(e); } return obj; }
@Override public Object deserialize(Writable field) throws SerDeException { Object obj = super.deserialize(field); try { ((TBase) obj).read(inProtocol); } catch (Exception e) { throw new SerDeException(e); } return obj; }