<div dir="ltr">Hi,<div><br></div><div>I'm working on a network protocol that involves sending frames of data prefixed by their length and a checksum. The only realistic way to work out the length of a frame is to actually write the bytes out, although the length and checksum take up a fixed number of bytes.</div><div><br></div><div>If I were working in C I'd be filling a buffer, leaving space for the length/checksum, and then go back and fill them in at the end. So this is _almost_ what ByteString.Builder does except for the backtracking bit.</div><div><br></div><div>Does anyone know if there's an implementation of a thing that's a bit like ByteString.Builder but also allows for this kind of backtracking? Ideally I want to be able to batch up a number of frames into a single buffer, and deal gracefully with overflowing the buffer by allocating some more, much as Builder does.</div><div><br></div><div>I can't think of a terribly good way of doing this using the existing Builder implementation as it stands, although it looks quite easy to modify it to add this functionality so I might just do that locally if needs be.</div><div><br></div><div>Cheers,</div><div><br></div><div>David</div><div><br></div><div><br></div><div><br></div></div>