[RFE] A mechanism for resetting GConverterInputStream?
Once a GConverter
associated with a GConverterInputStream
returns G_CONVERTER_FINISHED
from its convert implementation, a 'finished' flag internal to GConverterInputStream
is set which prevents any further reads regardless of whether the converter's state is reset. This is especially problematic since the GConverterInputStream
may have buffered additional data beyond that which was handled by the converter; simply creating a new converter stream from the original base stream and reset converter means the overread bytes are lost.
It would be great if maybe there was a g_converter_input_stream_reset
function or a reset signal on GConverter
that a GConverterInputStream
could monitor.
This has come up in handling files from the Internet Archive: an approach they use to compress data in an aggregate file whilst keeping individual records randomly-accessible is to compress them individually with gzip and concatenate the results together. If the corresponding index is available then GConverterInputStream
works great, but otherwise it's unusable; once the end of a gzip stream is encountered there's no way to reset the state of the GConverterInputStream
in order to read in the next, and the base stream is rendered useless since the unresettable converter stream has likely already read the next gzip header into its buffer with no way of figuring out its offset.