class_docstr: _StreamIODataset
code: def __init__(self, function, internal=True, **kwargs):
      if not internal:
          raise ValueError(
              "StreamIODataset constructor is private; please use one "
              "of the factory methods instead (e.g., "
              "IODataset.from_kafka())"
          )
      with tf.name_scope("StreamIODataset"):
          capacity = kwargs.get("capacity", 4096)
          dataset = tf.compat.v2.data.Dataset.range(
              0, sys.maxsize, capacity
          )
          dataset = dataset.map(
              lambda index: function(index, index + capacity)
          )
          dataset = dataset.apply(
              tf.data.experimental.take_while(
                  lambda v: tf.greater(tf.shape(v)[0], 0)
              )
          )
          dataset = dataset.unbatch()
  
          self._function = function
          self._dataset = dataset
          super().__init__(self._dataset._variant_tensor)
  
file_path: io/tensorflow_io/python/ops/io_dataset_ops.py
imports: import sys
  import tensorflow
label_desc: Use image node_id 1 to create a new _StreamIODataset object from inherited base classes: tf.compat.v2.data with example: obj = _StreamIODataset(function, internal)