You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently TranscodingStreams has default methods for seekstartseekend and position. position implementation is based on the bytes read from the io. However, when seekstart or seekend is called, it will lead to invalid position. For example:
# Create a gzip fileusing CodecZlib
s =GzipCompressorStream(open("/tmp/test.txt.gz", "w"))
write(s, "abbccc"); close(s)
# Reading stream
s =GzipDecompressorStream(open("/tmp/test.txt.gz"))
read(s, Char); position(s) ## position is 1, correct!seekstart(s); position(s) ## position changes to 6, it should be 0read(s, Char); position(s) ## position changes to 7, it should be 1seekend(s); position(s) ## position changes to 12, it should be 6
I think when seekstart is called, we probably need to reset the Stats of the stream. For seekend, I think it might be hard/impossible to get the right position after decompression, however at least an warning should be given. seek is not provided by default, however if a Codec implements only seek but not position, it might leads invalid position as well.
What's your thoughts on this issue? Maybe it is possible to just issue an warning when calling position after called seek/seekstart/seekend? Then a Codec might implements its specialized methods for position (e.g. for Noop).
The text was updated successfully, but these errors were encountered:
Currently TranscodingStreams has default methods for
seekstart
seekend
andposition
.position
implementation is based on the bytes read from the io. However, whenseekstart
orseekend
is called, it will lead to invalid position. For example:I think when
seekstart
is called, we probably need to reset the Stats of the stream. Forseekend
, I think it might be hard/impossible to get the right position after decompression, however at least an warning should be given.seek
is not provided by default, however if a Codec implements onlyseek
but notposition
, it might leads invalid position as well.What's your thoughts on this issue? Maybe it is possible to just issue an warning when calling
position
after called seek/seekstart/seekend? Then a Codec might implements its specialized methods forposition
(e.g. forNoop
).The text was updated successfully, but these errors were encountered: