MCPcopy Create free account
hub / github.com/apache/thrift / deserialize

Method deserialize

lib/php/lib/Serializer/TBinarySerializer.php:64–86  ·  view source on GitHub ↗
($string_object, $class_name, $buffer_size = 8192)

Source from the content-addressed store, hash-verified

62 }
63
64 public static function deserialize($string_object, $class_name, $buffer_size = 8192)
65 {
66 $transport = new TMemoryBuffer();
67 $protocol = new TBinaryProtocolAccelerated($transport);
68 if (function_exists('thrift_protocol_read_binary')) {
69 // NOTE (t.heintz) TBinaryProtocolAccelerated internally wraps our TMemoryBuffer in a
70 // TBufferedTransport, so we have to retrieve it again or risk losing data when writing
71 // less than 512 bytes to the transport (see the comment there as well).
72 // @see THRIFT-1579
73 $protocol->writeMessageBegin('', TMessageType::REPLY, 0);
74 $protocolTransport = $protocol->getTransport();
75 $protocolTransport->write($string_object);
76 $protocolTransport->flush();
77
78 return thrift_protocol_read_binary($protocol, $class_name, $protocol->isStrictRead(), $buffer_size);
79 } else {
80 $transport->write($string_object);
81 $object = new $class_name();
82 $object->read($protocol);
83
84 return $object;
85 }
86 }
87}

Callers 2

testBinarySerializerMethod · 0.45
TestClient.phpFile · 0.45

Calls 7

isStrictReadMethod · 0.80
writeMessageBeginMethod · 0.65
writeMethod · 0.65
readMethod · 0.65
getTransportMethod · 0.45
flushMethod · 0.45

Tested by 1

testBinarySerializerMethod · 0.36