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

# Interface ParameterBuffer

All Superinterfaces:
  `Iterable<Parameter>`, `Serializable`

All Known Subinterfaces:
  `BatchParameterBuffer`, `BlobParameterBuffer`, `ConnectionParameterBuffer`, `DatabaseParameterBuffer`, `ServiceParameterBuffer`, `ServiceRequestBuffer`, `TransactionParameterBuffer`

All Known Implementing Classes:
  `BatchParameterBufferImp`, `BlobParameterBufferImp`, `DatabaseParameterBufferImp`, `ParameterBufferBase`, `ServiceParameterBufferImp`, `ServiceRequestBufferImp`, `TransactionParameterBufferImpl`

public interface ParameterBuffer extends Iterable<Parameter>, Serializable
Instance of this interface represents a Parameter Buffer it is extended by various parameter buffer interfaces.

Since:
  3.0
Author:
  Mark Rotteveel
See Also:
  - `ParameterBuffer`
  - `ServiceRequestBuffer`
  - `TransactionParameterBuffer`
  - `ServiceParameterBuffer`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addArgument(int argumentType)`
  Add argument with no parameters.
  `void`
  `addArgument(int argumentType, byte value)`
  Add a byte argument.
  `void`
  `addArgument(int argumentType, byte[] content)`
  Add array of bytes.
  `void`
  `addArgument(int argumentType, int value)`
  Add integer argument.
  `void`
  `addArgument(int argumentType, long value)`
  Add long argument.
  `void`
  `addArgument(int argumentType, String value)`
  Add string argument with the default encoding.
  `void`
  `addArgument(int argumentType, String value, Encoding encoding)`
  Add string argument.
  `int`
  `getArgumentAsInt(int argumentType)`
  Get argument as int.
  `String`
  `getArgumentAsString(int argumentType)`
  Get argument as string.
  `int`
  `getType()`
  `boolean`
  `hasArgument(int argumentType)`
  Check if this parameter buffer has specified argument.
  `default boolean`
  `isEmpty()`
  `Iterator<Parameter>`
  `iterator()`
  Returns an iterator over a copy of the parameters in this parameter buffer.
  `void`
  `removeArgument(int argumentType)`
  Remove the first occurrence of the specified argument.
  `int`
  `size()`
  `byte[]`
  `toBytes()`
  Converts this parameter buffer to a byte array.
  `byte[]`
  `toBytesWithType()`
  Converts this parameter buffer to a byte array with type information.
  `Xdrable`
  `toXdrable()`
  `void`
  `writeArgumentsTo(OutputStream outputStream)`
  Writes the arguments in the implementation specific serialization into the `OutputStream`.

  ### Methods inherited from interface java.lang.Iterable

  `forEach, spliterator`

- ## Method Details

  - ### getType

    int getType()
    Returns:
      The parameter buffer type identifier

  - ### addArgument

    void addArgument(int argumentType)
    Add argument with no parameters.
    Parameters:
      `argumentType` - type of argument.

  - ### addArgument

    void addArgument(int argumentType, String value)
    Add string argument with the default encoding.
    Parameters:
      `argumentType` - type of argument.
      `value` - string value to add.

  - ### addArgument

    void addArgument(int argumentType, String value, Encoding encoding)
    Add string argument.
    Parameters:
      `argumentType` - type of argument.
      `value` - string value to add.
      `encoding` - encoding to use for conversion to bytes

  - ### addArgument

    void addArgument(int argumentType, byte value)
    Add a byte argument.
    Parameters:
      `argumentType` - type of argument.
      `value` - byte value to add.

  - ### addArgument

    void addArgument(int argumentType, int value)
    Add integer argument.
    Parameters:
      `argumentType` - type of argument.
      `value` - integer value to add.

  - ### addArgument

    void addArgument(int argumentType, long value)
    Add long argument.
    Parameters:
      `argumentType` - type of argument.
      `value` - long value to add.

  - ### addArgument

    void addArgument(int argumentType, byte[] content)
    Add array of bytes.
    Parameters:
      `argumentType` - type of argument.
      `content` - content of argument.

  - ### removeArgument

    void removeArgument(int argumentType)
    Remove the first occurrence of the specified argument.
    Parameters:
      `argumentType` - type of argument to remove.

  - ### getArgumentAsString

    String getArgumentAsString(int argumentType)
    Get argument as string.
    Parameters:
      `argumentType` - type of argument to find.
    Returns:
      argument as string or `null` if nothing found.

  - ### getArgumentAsInt

    int getArgumentAsInt(int argumentType)
    Get argument as int.
    Parameters:
      `argumentType` - type of argument to find.
    Returns:
      argument as string or `0` if nothing found.

  - ### hasArgument

    boolean hasArgument(int argumentType)
    Check if this parameter buffer has specified argument.
    Parameters:
      `argumentType` - type of argument to find.
    Returns:
      `true` if this buffer contains specified argument.

  - ### iterator

    Iterator<Parameter> iterator()
    Returns an iterator over a copy of the parameters in this parameter buffer.

    It is safe to iterate over this iterator while modifying the parameter buffer. Changes will not be reflected in the iterator.

    Specified by:
      `iterator` in interface `Iterable<Parameter>`
    Returns:
      Iterator over the parameters in this parameter buffer.

  - ### writeArgumentsTo

    void writeArgumentsTo(OutputStream outputStream) throws IOException
    Writes the arguments in the implementation specific serialization into the `OutputStream`.
    Parameters:
      `outputStream` - The `OutputStream` to write to
    Throws:
      `IOException` - Errors produced by the output stream during writes

  - ### toXdrable

    Xdrable toXdrable()
    Returns:
      `Xdrable` to write (and optionally read) this instance as Xdr.

  - ### toBytes

    byte[] toBytes()
    Converts this parameter buffer to a byte array.

    This byte array includes the extra header-bytes (if any), but does not include the type information

    Returns:
      Byte array with serialization of this parameter buffer
    See Also:
      - `toBytesWithType()`

  - ### toBytesWithType

    byte[] toBytesWithType()
    Converts this parameter buffer to a byte array with type information.

    This byte array includes the type information and the extra header bytes (if any).

    Returns:
      Byte array with serialization of this parameter buffer
    See Also:
      - `toBytes()`

  - ### size

    int size()
    Returns:
      the number of parameters stored.

  - ### isEmpty

    default boolean isEmpty()
    Returns:
      `true` if empty, `false` if this buffer contains at least one parameter
    Since:
      6.0.2