clj-commons / manifold

A compatibility layer for event-driven abstractions
1.02k stars 106 forks source link

ProcessPipeInputStream #199

Closed dpom closed 3 years ago

dpom commented 3 years ago

Is it possible to convert (or transfer bytes) from a java.lang.ProcessImpl$ProcessPipeInputStream to a manifold stream?

KingMob commented 3 years ago

Hi @dpom ! For future reference, the #aleph channel on the Clojurians Slack is the best place to get answers for questions like this.

In this case, you want to pull in byte-streams for the conversion. E.g.:

(require '[byte-streams :as bs])
(bs/convert your-process-input-pipe-stream (bs/stream-of bytes) {:chunk-size 4096}) 

will give you a Manifold stream that returns byte arrays in 4096-byte chunks.

There's other built-in conversion options, and you can define your own, too. Hope this helps.

dpom commented 3 years ago

Thanks @KingMob for the information and the solution