Module org.firebirdsql.jaybird
Package org.firebirdsql.gds

# Class ClumpletReader

java.lang.Object
org.firebirdsql.gds.ClumpletReader

@NullMarked public final class ClumpletReader extends Object
Reader for clumplets, similar to the implementation of `ClumpletReader.cpp` in Firebird.

Since:
  3.0
Author:
  Mark Rotteveel

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static enum`
  `ClumpletReader.ClumpletType`
  `static enum`
  `ClumpletReader.Kind`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ClumpletReader(ClumpletReader.Kind kind, byte @Nullable [] buffer)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `adjustSpbState()`
  `boolean`
  `directNext(int tag)`
  Checks if the next tag in this reader is `tag`.
  `boolean`
  `find(int tag)`
  `int`
  `getBufferTag()`
  `byte[]`
  `getBytes()`
  `int`
  `getClumpLength()`
  `int`
  `getClumpletSize(boolean wTag, boolean wLength, boolean wData)`
  `ClumpletReader.ClumpletType`
  `getClumpletType(byte tag)`
  `int`
  `getClumpTag()`
  `int`
  `getInt()`
  `long`
  `getLong()`
  `String`
  `getString(Charset charset)`
  `String`
  `getString(Encoding encoding)`
  `boolean`
  `isEof()`
  `boolean`
  `isTagged()`
  `void`
  `moveNext()`
  `boolean`
  `next(int tag)`
  Finds the next `tag` in the reader, skipping tags to find it.
  `void`
  `rewind()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ClumpletReader

    public ClumpletReader(ClumpletReader.Kind kind, byte @Nullable [] buffer)

- ## Method Details

  - ### isTagged

    public boolean isTagged()

  - ### getBufferTag

    public int getBufferTag() throws SQLException
    Throws:
      `SQLException`

  - ### getClumpletType

    public ClumpletReader.ClumpletType getClumpletType(byte tag) throws SQLException
    Throws:
      `SQLException`

  - ### adjustSpbState

    public void adjustSpbState() throws SQLException
    Throws:
      `SQLException`

  - ### getClumpletSize

    public int getClumpletSize(boolean wTag, boolean wLength, boolean wData) throws SQLException
    Throws:
      `SQLException`

  - ### moveNext

    public void moveNext() throws SQLException
    Throws:
      `SQLException`

  - ### rewind

    public void rewind()

  - ### find

    public boolean find(int tag) throws SQLException
    Throws:
      `SQLException`

  - ### next

    public boolean next(int tag) throws SQLException
    Finds the next `tag` in the reader, skipping tags to find it.

    If `tag` is not found, the original position of this reader is retained.

    Parameters:
      `tag` - Tag to find
    Returns:
      `true` if `tag` was found and this reader is positioned to read it, `false` otherwise
    Throws:
      `SQLException` - For errors positioning
    See Also:
      - `directNext(int)`

  - ### directNext

    public boolean directNext(int tag) throws SQLException
    Checks if the next tag in this reader is `tag`.

    If the next tag is not `tag`, the original position of this reader is retained.

    Parameters:
      `tag` - Tag to find
    Returns:
      `true` if the next tag is `tag` and this reader is positioned to read it, `false` otherwise
    Throws:
      `SQLException` - For errors positioning
    Since:
      5
    See Also:
      - `next(int)`

  - ### getClumpTag

    public int getClumpTag() throws SQLException
    Throws:
      `SQLException`

  - ### getClumpLength

    public int getClumpLength() throws SQLException
    Throws:
      `SQLException`

  - ### getBytes

    public byte[] getBytes() throws SQLException
    Throws:
      `SQLException`

  - ### getInt

    public int getInt() throws SQLException
    Throws:
      `SQLException`

  - ### getLong

    public long getLong() throws SQLException
    Throws:
      `SQLException`

  - ### getString

    public String getString(Encoding encoding) throws SQLException
    Throws:
      `SQLException`

  - ### getString

    public String getString(Charset charset) throws SQLException
    Throws:
      `SQLException`

  - ### isEof

    public boolean isEof()