com.streambase.sb.client

## Class StreamBaseClient.TupleBuffer

- java.lang.Object
- - com.streambase.sb.client.StreamBaseClient.TupleBuffer

- Direct Known Subclasses:
    StreamBaseClient.SerializedTupleBuffer
  Enclosing class:
    StreamBaseClient

      public abstract class StreamBaseClient.TupleBuffer
      extends Object

  Class for abstracting away where tuples come from, Buffers, Collections, and Single Enqueues.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `(package private) int` | `bufferTupleCount` Number of tuples in buffer

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TupleBuffer(StreamProperties props)` Constructor

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract void` | `addToBuffer(Tuple tuple, int id)` Add to buffer
    `(package private) boolean` | `addTuple(Tuple tuple)` Add a tuple
    `(package private) boolean` | `addTuples(Collection<Tuple> tuples)` Add tuples
    `boolean` | `canDequeue(StreamProperties props)` Can dequeue?
    `boolean` | `canEnqueue(StreamProperties props)` Can enqueue?
    `protected void` | `checkTuple(Tuple tuple)` Check tuple to make sure it is up to snuff
    `(package private) abstract void` | `enqueue(boolean hasMore)` actually enqueue the buffer
    `boolean` | `equals(Object obj)`
    `int` | `hashCode()`
    `(package private) abstract long` | `numBytes()` Number of bytes in buffer
    `StreamProperties` | `props()` get stream properties for this Buffer
    `(package private) void` | `recycle()` Clear the TupleBuffer
    `int` | `tupleCount()` Get tuple count

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

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

- - ### Field Detail

    - #### bufferTupleCount

          int bufferTupleCount

      Number of tuples in buffer

  - ### Constructor Detail

    - #### TupleBuffer

          TupleBuffer(StreamProperties props)

      Constructor
      Parameters:
        `props` - Properties

  - ### Method Detail

    - #### addTuple

          boolean addTuple(Tuple tuple)
                    throws StreamBaseException

      Add a tuple
      Parameters:
        `tuple` - Tuple to add
      Returns:
        true if more tuples can be added
      Throws:
        `StreamBaseException` - Error adding tuple

    - #### addTuples

          boolean addTuples(Collection<Tuple> tuples)
                     throws StreamBaseException

      Add tuples
      Parameters:
        `tuples` - Tuples to add
      Returns:
        true if more tuples can be added
      Throws:
        `StreamBaseException` - Error adding tuples

    - #### addToBuffer

          protected abstract void addToBuffer(Tuple tuple,
                                              int id)
                                       throws TupleException

      Add to buffer
      Parameters:
        `tuple` - Tuple to add
        `id` - Identifier
      Throws:
        `TupleException` - Error adding to buffer

    - #### numBytes

          abstract long numBytes()

      Number of bytes in buffer
      Returns:
        Number of bytes

    - #### recycle

          void recycle()

      Clear the TupleBuffer

    - #### enqueue

          abstract void enqueue(boolean hasMore)
                         throws StreamBaseException

      actually enqueue the buffer
      Parameters:
        `hasMore` - are there more Tuples in this batch of tuples
      Throws:
        `StreamBaseException`

    - #### props

          public StreamProperties props()

      get stream properties for this Buffer
      Returns:
        stream properties for the buffer

    - #### checkTuple

          protected void checkTuple(Tuple tuple)

      Check tuple to make sure it is up to snuff
      Parameters:
        `tuple` -

    - #### equals

          public boolean equals(Object obj)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### tupleCount

          public int tupleCount()

      Get tuple count
      Returns:
        Number of tuples

    - #### canEnqueue

          public boolean canEnqueue(StreamProperties props)

      Can enqueue?
      Parameters:
        `props` - Properties
      Returns:
        true if can enqueue, false otherwise

    - #### canDequeue

          public boolean canDequeue(StreamProperties props)

      Can dequeue?
      Parameters:
        `props` - Properties
      Returns:
        true if can dequeue, false otherwise

Copyright © 2015–2018 Cloud Software Group, Inc.. All rights reserved.