How to create a binary stream (not a file) in Common Lisp?

你离开我真会死。 提交于 2019-12-10 15:03:36

问题


I have a function which output some binary data to a stream. But the stream is abstract, which means the stream can be a file stream, or some other streams. But the stream must be a binary stream which support write-byte function. I searched but not found the answer.

What I want to do is, I have a function which will convert some data to a gif. But I donot want to output the data to a file, I want to output it to something in memory.

Thanks.


回答1:


The flexi-streams library provides, among other things, in-memory binary streams.




回答2:


"File in memory" - is just a byte array. So all you need is to read your data from stream and write it to one-dimensional array (vector). For more information on arrays in CL see this.



来源:https://stackoverflow.com/questions/7441992/how-to-create-a-binary-stream-not-a-file-in-common-lisp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!