-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why implement Buffer
and Memory
?
#125
Comments
Actually, Maybe it makes sense to use I think it's better design to have two separate structs for input and output transcoding, instead of keeping this logic inside some state component. It would also make the logic simpler since we don't have to worry about writing while in read state or vice versa. Any thoughts? Maybe @jakobnissen ? |
It seems complex to me too, but my experience is that usually stuff is complicated because there are edge cases I havne't thought of. I don't think we can remove |
Hey I've just been poking around this package and it seems overly complex. Can someone more familiar with it make sure I haven't just missed Chesterton's fence 😛 Happy to work on this if people agree it makes sense
AFAICT,
TranscodingStream
manages an input and outputBuffer
; data is read from the input stream into the inputBuffer
. This is passed to a codec viaMemory
(which is just an abstraction over the "used" and "free" parts of aBuffer
). The codec writes to the outputBuffer
, and that's given to the user via an output stream when requested.Memory
. I can't figure out why this is useful, aside from just making things slightly easier for downstream codecs that are C-based and need pointers. If that's the case, we could views instead.Buffer
. We really don't need our own implementation; I thinkIOBuffer
should work. Fundamentally, we just want to load data from the input stream into some input array, let a codec convert part of that to an output array, and send it to the user via a stream.Less importantly:
Error
. Why not justtry/catch
instead of passing yet another variable around as state?The text was updated successfully, but these errors were encountered: