Record Class TerminalChunk

java.lang.Object
java.lang.Record
org.apache.juneau.terminal.region.TerminalChunk
Record Components:
bytes - The bytes read, never null; empty at the end of the stream.
next - The offset to read from next.
end - The source's current end offset.
done - Whether the producer will write no more and next == end.
cols - The producer's terminal width.
rows - The producer's terminal height.
truncated - Whether the requested offset was no longer held, so the bytes start at the oldest offset held.
gone - Whether the backing store disappeared; implies done. A gone chunk is empty, and its next and end are the requested offset.

public record TerminalChunk(byte[] bytes, long next, long end, boolean done, int cols, int rows, boolean truncated, boolean gone) extends Record
One read from a TerminalSource.

Offsets are absolute byte positions since the stream started; they never reset. bytes starts at next - bytes.length, which is the requested offset unless truncated is set.

The record holds the bytes array itself, not a copy, and equality on it is by identity; treat it as read-only.

  • Constructor Summary

    Constructors
    Constructor
    Description
    TerminalChunk(byte[] bytes, long next, long end, boolean done, int cols, int rows, boolean truncated, boolean gone)
    Checks the members.
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    Returns the value of the bytes record component.
    int
    Returns the value of the cols record component.
    boolean
    Returns the value of the done record component.
    long
    end()
    Returns the value of the end record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    boolean
    Returns the value of the gone record component.
    final int
    Returns a hash code value for this object.
    long
    Returns the value of the next record component.
    int
    Returns the value of the rows record component.
    final String
    Returns a string representation of this record class.
    boolean
    Returns the value of the truncated record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • TerminalChunk

      public TerminalChunk(byte[] bytes, long next, long end, boolean done, int cols, int rows, boolean truncated, boolean gone)
      Checks the members.
      Throws:
      IllegalArgumentException - If a member is out of range.
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • bytes

      public byte[] bytes()
      Returns the value of the bytes record component.
      Returns:
      the value of the bytes record component
    • next

      public long next()
      Returns the value of the next record component.
      Returns:
      the value of the next record component
    • end

      public long end()
      Returns the value of the end record component.
      Returns:
      the value of the end record component
    • done

      public boolean done()
      Returns the value of the done record component.
      Returns:
      the value of the done record component
    • cols

      public int cols()
      Returns the value of the cols record component.
      Returns:
      the value of the cols record component
    • rows

      public int rows()
      Returns the value of the rows record component.
      Returns:
      the value of the rows record component
    • truncated

      public boolean truncated()
      Returns the value of the truncated record component.
      Returns:
      the value of the truncated record component
    • gone

      public boolean gone()
      Returns the value of the gone record component.
      Returns:
      the value of the gone record component