Interface TerminalSource

All Known Implementing Classes:
FileTerminalSource, MemoryTerminalSource

public interface TerminalSource
A growing stream of raw terminal bytes, read by absolute byte offset.

The bytes are exactly what the producer's terminal wrote, escape sequences included. The server never decodes them.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The largest number of bytes one read(long, int) returns.
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    Copies every byte still held, oldest first, up to the end at the time of the call.
    read(long fromOffset, int maxBytes)
    Reads up to maxBytes bytes starting at fromOffset.
  • Field Details

  • Method Details

    • read

      TerminalChunk read(long fromOffset, int maxBytes) throws IOException
      Reads up to maxBytes bytes starting at fromOffset.

      When fromOffset equals the end, the chunk is empty. When it is past the end, the chunk is empty, its next is its end, and that is below fromOffset, which the endpoint answers with 416. When it is no longer held, the chunk is truncated and starts at the oldest offset held. When the backing store has disappeared, the chunk is empty and gone, with next and end equal to fromOffset.

      Parameters:
      fromOffset - The offset to read from, at least 0.
      maxBytes - The most bytes to return, clamped to 0-MAX_READ_BYTES.
      Returns:
      The chunk.
      Throws:
      IOException - If the backing store could not be read.
    • copyTo

      default void copyTo(OutputStream out) throws IOException
      Copies every byte still held, oldest first, up to the end at the time of the call.

      If the oldest bytes have been overwritten, the copy starts at the oldest offset held and the gap is skipped.

      Parameters:
      out - The stream to write to.
      Throws:
      IOException - If the source could not be read or the stream written.