chaokunyang commented on code in PR #3374:
URL: https://github.com/apache/fory/pull/3374#discussion_r2877035536
##########
go/fory/fory.go:
##########
@@ -495,6 +496,105 @@ func (f *Fory) Deserialize(data []byte, v any) error {
return nil
}
+// StreamReader supports robust sequential deserialization from a stream.
+// It maintains the ByteBuffer and ReadContext state across multiple
Deserialize calls,
+// preventing data loss from prefetched buffers and preserving TypeResolver
metadata
+// (Meta Sharing) across object boundaries.
+type StreamReader struct {
+ fory *Fory
+ reader io.Reader
+ buffer *ByteBuffer
+}
+
+// NewStreamReader creates a new StreamReader that reads from the provided
io.Reader.
+// The StreamReader owns the buffer and maintains state across sequential
Deserialize calls.
+func (f *Fory) NewStreamReader(r io.Reader) *StreamReader {
Review Comment:
Looks really strange that the StreamReader is coupled with Fory.
Please read fory c++ implementation detaily and refine this PR, especially
for API surface
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]