Skip to content
FutureBlitz

    Install

    Import std.io.buffered

    std.io.buffered

    Buffered streams: BufferedReader reads another Reader a buffer at a time, so that many small reads, a byte or a line at a time, cost one of its; BufferedWriter writes another Writer a buffer at a time. Their Async twins go through the other stream's.

    std/io/buffered.fb

    Types

    BufferedReader class

    Public Class BufferedReader Implements Reader

    Reads another Reader a buffer's bytes at a time, and gives them as they're asked for, a byte or a line at a time too.

    std/io/buffered.fb, line 12

    • @PanicsAtCaller Public New(inner: Reader, size: Int64 = 4096) constructor #

      Reads inner size bytes at a time. Panics when size is below 1.

    • Public Method Read(into: Buffer<UInt8>): Int64 Throws IOError method #

      As many as it has of what's next, or a read of the other Reader's. One for a whole buffer or more goes straight to the other Reader when it has none.

    • Public Async Method ReadAsync(into: Buffer<UInt8>): Int64 Throws IOError method #

      Read's Async twin, which waits on the main thread instead of blocking it. One that can only block reads with Read.

      Doc from std.io.streams.Reader.ReadAsync.

    • Public Method ReadByte(): UInt8? Throws IOError method #

      The next byte, or Null once the stream has ended.

    • Public Async Method ReadByteAsync(): UInt8? Throws IOError method #

      ReadByte's Async twin, through the other Reader's ReadAsync.

    • Public Method ReadLine(): String? Throws IOError method #

      The next line, without the \n or \r\n that ends it, or Null once the stream has ended. A last line without one is a line too. When the other Reader throws, what it had of the line waits for the next ReadLine, which goes on with it.

    • Public Async Method ReadLineAsync(): String? Throws IOError method #

      ReadLine's Async twin, through the other Reader's ReadAsync.

    BufferedWriter class

    Public Class BufferedWriter Implements Writer

    Writes another Writer a buffer's bytes at a time: what's written waits in a buffer until a write doesn't fit what's left of it, or Flush sends it on. What's still waiting when it goes is written then, without the errors that Flush would give.

    std/io/buffered.fb, line 136

    • @PanicsAtCaller Public New(inner: Writer, size: Int64 = 4096) constructor #

      Writes inner size bytes at a time. Panics when size is below 1.

    • Public Method Write(from: Buffer<UInt8>) Throws IOError method #

      Keeps the bytes, sending on what waits first when they don't fit what's left of the buffer. A write of a whole buffer or more goes straight to the other Writer, after what waits.

    • Public Async Method WriteAsync(from: Buffer<UInt8>) Throws IOError method #

      Write's Async twin, which waits on the main thread instead of blocking it.

      Doc from std.io.streams.Writer.WriteAsync.

    • Public Method Flush() Throws IOError method #

      Sends on what waits, and flushes the other Writer.

    • Public Async Method FlushAsync() Throws IOError method #

      Flush's Async twin.

      Doc from std.io.streams.Writer.FlushAsync.

    Report an issue with this page or with FutureBlitz on GitHub.