clj-commons / byte-streams

A Rosetta stone for JVM byte representations
417 stars 33 forks source link

Undeclared behavior for transfer {:close? true} #38

Closed lukeneil closed 3 years ago

lukeneil commented 5 years ago

The docstring for transfer documents the behavior of of the :close? flag as the following:

close? - whether the sink should be closed once the transfer is done, defaults to true.

However, on further inspection, transfer-fn appears to close both the source and sink streams when :close? is set, leading to potentially undesirable behavior if the caller is not expecting the source stream to close.

I would suggest either updating the docstring or behavior to be consistent with the user's expectations.

KingMob commented 3 years ago

I think for now, the documentation should be updated to reflect that transfer will attempt to close both the source and sink.

KingMob commented 3 years ago

Fixed by #44