Who should be responsible for closing a stream

前端 未结 3 1280
后悔当初
后悔当初 2021-02-14 13:38

I\'m writing an application that creates a \"Catalog\" of files, which can be attributed with other meta data files such as attachments and thumbnails.

I\'m trying to ab

3条回答
  •  猫巷女王i
    2021-02-14 13:47

    My spontaneous thought in this case is that the consumer should hold the responsibility for closing the streams. An IFileSystemAdaptor can't know when the consumer is done using the stream, so it also can't decide when to close it.

提交回复
热议问题