# Class StreamingListener.Adapter

java.lang.Object
com.codename1.ai.StreamingListener.Adapter

All Implemented Interfaces:
  `StreamingListener`

Enclosing interface:
  `StreamingListener`

public static class StreamingListener.Adapter extends Object implements StreamingListener
No-op default implementation. Subclass and override only what you need.

- ## Nested Class Summary

  ### Nested classes/interfaces inherited from interface StreamingListener

  `StreamingListener.Adapter`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Adapter()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `onContentDelta(String textDelta)`
  A chunk of assistant text.
  `void`
  `onError(Throwable t)`
  Mid-stream error (e.g. connection reset).
  `void`
  `onToolCallDelta(int index, String id, String name, String argumentsFragment)`
  A tool-call fragment.
  `void`
  `onUsage(Usage usage)`
  Token-accounting update.

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### Adapter

    public Adapter()

- ## Method Details

  - ### onContentDelta

    public void onContentDelta(String textDelta)
    Description copied from interface: `StreamingListener`
    A chunk of assistant text. Append it to whatever text buffer you're rendering.
    Specified by:
      `onContentDelta` in interface `StreamingListener`
    Parameters:
      `textDelta` - next ordered text fragment

  - ### onToolCallDelta

    public void onToolCallDelta(int index, String id, String name, String argumentsFragment)
    Description copied from interface: `StreamingListener`
    A tool-call fragment. `index` lets you correlate fragments that belong to the same call when multiple tools are streamed in parallel. `name` is non-null on the first fragment for each call. `argumentsFragment` is the next slice of the arguments JSON; concatenate fragments for the same `index` to reassemble. `id` is the provider's tool-call id, present on the first fragment.
    Specified by:
      `onToolCallDelta` in interface `StreamingListener`
    Parameters:
      `index` - zero-based tool call within the response
      `id` - provider tool-call id, normally present on the first fragment
      `name` - requested tool name, normally present on the first fragment
      `argumentsFragment` - next JSON argument fragment

  - ### onUsage

    public void onUsage(Usage usage)
    Description copied from interface: `StreamingListener`
    Token-accounting update. Most providers send this once at the end; some send incremental counts.
    Specified by:
      `onUsage` in interface `StreamingListener`
    Parameters:
      `usage` - latest provider token counts

  - ### onError

    public void onError(Throwable t)
    Description copied from interface: `StreamingListener`
    Mid-stream error (e.g. connection reset). The `AsyncResource` returned by `chatStream` will also complete with this same exception, so listeners can typically ignore this and react to the resource. Implemented for parity with other SDKs.
    Specified by:
      `onError` in interface `StreamingListener`
    Parameters:
      `t` - stream failure also delivered by the returned resource