Fixes #37 by removing the finalize method from the closeable-seq that closes input streams/channels prematurely.
Since the existing behavior was already broken, and many other conversions already require you manage/close resources yourself anyway, I'm comfortable making that the requirement.
While doing this, I looked over the other conversions, to see if any of them leaked file descriptors. The File -> (seq-of ByteBuffer) conversion was also subject to this problem, and did not close its own resources. It's been updated to automatically close the file upon exhaustion (Maybe this should be an option? We wouldn't want to stop tailing a growing log file just because we temporarily caught up to the end...)
I also updated the File -> WritableByteChannel and File -> ReadableByteChannel conversions. It wasn't 100% clear from the javadocs whether the linked streams would close when their channels did, so to avoid that, I bypassed the File*Streams.
Finally, a bunch of tests were added to prevent regressions, including one of a large file.
Fixes #37 by removing the
finalize
method from the closeable-seq that closes input streams/channels prematurely.Since the existing behavior was already broken, and many other conversions already require you manage/close resources yourself anyway, I'm comfortable making that the requirement.
While doing this, I looked over the other conversions, to see if any of them leaked file descriptors. The
File -> (seq-of ByteBuffer)
conversion was also subject to this problem, and did not close its own resources. It's been updated to automatically close the file upon exhaustion (Maybe this should be an option? We wouldn't want to stop tailing a growing log file just because we temporarily caught up to the end...)I also updated the
File -> WritableByteChannel
andFile -> ReadableByteChannel
conversions. It wasn't 100% clear from the javadocs whether the linked streams would close when their channels did, so to avoid that, I bypassed theFile*Streams
.Finally, a bunch of tests were added to prevent regressions, including one of a large file.