stl_io icon indicating copy to clipboard operation
stl_io copied to clipboard

Allow `create_stl_reader` to use readers that don't implement Seek

Open unlimitedbacon opened this issue 3 years ago • 2 comments

I have a request for my program to take input from stdin (which is not seekable) instead of a file. As it stands, I must read all the STL data into a buffer that implements Seek, before passing it to create_stl_reader. It would be nice if this requirement could be removed.

unlimitedbacon avatar May 30 '22 03:05 unlimitedbacon

The current reader first probes if the file is ASCII. Then it seeks back to the start and either reads ASCII or BINARY. One way to get away without seek would be:

Call ReadLine from the input file, create BufReader from that line. Pass that reader to probe. Seek the BufReader to the start, chain BufReader and input and pass that to the read method.

Do you want to write a PR for this?

hmeyer avatar May 30 '22 05:05 hmeyer

Yes, I think that I can take a stab at it.

unlimitedbacon avatar May 30 '22 05:05 unlimitedbacon