Skip to content

[io-2] Reusable Input #71

Closed
Closed
@altavir

Description

@altavir

Another feature I would like to see (and contribute) after io-2 release is the reusable Input (and maybe output) abstraction. It could look like this. The idea is that we have an Input provider that could be instantiated and reused in a safe way. Tho simple examples are file and a network stream. In case of file, we do not have to get file input, just a file reference, and the open, use and close the input automatically (my code have also an interface of RandomAccessBinary which could be used to access file not from the beginning). Another case is a network connection. Here, we won't close the input after read, but we will provide thread safe access for several readers to the same stream without them knowing about one another.

I am not sure about the size field. It is quite helpful in case one needs to copy the whole input to another binary, or in case of random access, but could be bothersome for infinite streams.

The same could be probably done for output, but I did not encounter use case so far.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions