Streams interface for D
Go to file
Tristan B. Velloza Kildaire 62d77adc80 SockStream
- Removed FIXME which was actually an error in how we were testing and NOT `writeFully(byte[])` itself
- Removed completed TODO for `writeFully(byte[])`
2023-05-26 10:18:11 +02:00
.github/workflows - Run unit tests 4 times for potential variations 2023-04-29 16:43:17 +02:00
branding - Added branding 2023-04-25 18:20:07 +02:00
source/river SockStream 2023-05-26 10:18:11 +02:00
.gitignore - Updated `.gitignore` to ignore `libriver.a` 2023-04-25 18:40:51 +02:00
README.md - Fixed typo in `README.md` 2023-05-09 09:47:43 +02:00
dub.json - Update package description 2023-04-30 14:07:46 +02:00

README.md

River

D

River provides a base interface describing a so-called "stream" interface, this entails the following methods:

  1. read(byte[] buff)
    • Reads into the provided buffer, buff, at most the number of bytes equal to the length of buff and at least 1 byte
    • On any error a StreamException is thrown
  2. readFully(byte[] buff)
    • Similar to read(byte[]) except it will block until the number of bytes read is exactly equal to the length of buff
    • On any error a StreamException is thrown
  3. write(byte[] buff)
    • Writes from the provided buffer, buff, at most the number of bytes equal to the length of buff and at least 1 byte
    • On any error a StreamException is thrown
  4. writeFully(byte[] buff)
    • Similar to write(byte[]) except it will block until the number of bytes written is exactly equal to the length of buff
    • On any error a StreamException is thrown
  5. close()
    • Closes the stream
    • On any error a StreamException is thrown

Checkout the Streams API.

Implementations

To go along with the streams API we also offer a few implementations of useful stream-types which you can use right away (or extend) within your application, these include:

  1. SockStream
    • Provides a streamable access to a Socket
    • Note, only works with SocketType.STREAM
  2. PipeStream
    • Provides a streamable access to a pipe pair of file descriptors
    • Note, only supports POSIX-like systems to far

... see the rest;