[ https://issues.apache.org/jira/browse/ARROW-4718?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Rok Mihevc updated ARROW-4718: ------------------------------ External issue URL: https://github.com/apache/arrow/issues/21242 > Add ArrowStreamWriter/Reader ctors that leave open the underlying Stream > ------------------------------------------------------------------------ > > Key: ARROW-4718 > URL: https://issues.apache.org/jira/browse/ARROW-4718 > Project: Apache Arrow > Issue Type: Improvement > Components: C# > Reporter: Stephen Toub > Assignee: Stephen Toub > Priority: Minor > Labels: performance, pull-request-available > Fix For: 0.13.0 > > Original Estimate: 1h > Time Spent: 1h 20m > Remaining Estimate: 0h > > It's often the case that data being read/written in arrow format is part of > some larger protocol. However, ArrowStreamWriter and ArrowStreamReader close > the provided stream when they're disposed. This means that if you need to, > for example, write a footer after the arrow data is written, you need to > actually construct the ArrowStreamWriter around some temporary stream, write > to that, then copy the data from that stream to the actual one that you then > write the footer to; otherwise, ArrowStreamWriter will end up disposing of > the stream before you have the opportunity to write the footer. > Throughout .NET, this approach is generally codified as a ctor that takes a > "leaveOpen" Boolean parameter, e.g. as on System.IO.StreamWriter > (https://docs.microsoft.com/en-us/dotnet/api/system.io.streamwriter.-ctor?view=netframework-4.7.2#System_IO_StreamWriter__ctor_System_IO_Stream_System_Text_Encoding_System_Int32_System_Boolean_) > or System.IO.DeflateStream > (https://docs.microsoft.com/en-us/dotnet/api/system.io.compression.deflatestream.-ctor?view=netframework-4.7.2#System_IO_Compression_DeflateStream__ctor_System_IO_Stream_System_IO_Compression_CompressionLevel_System_Boolean_). > > ArrowStreamReader and ArrowStreamWriter should do the same: > public ArrowStreamReader(Stream stream, bool leaveOpen); > public ArrowStreamWriter(Stream baseStream, Schema schema, bool leaveOpen); -- This message was sent by Atlassian Jira (v8.20.10#820010)