java.lang.Object
com.univocity.parsers.common.input.concurrent.CharBucket

class CharBucket extends Object
A buffer of characters.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) final char[]
    The bucket data
    (package private) int
    The number of characters this bucket contain.
  • Constructor Summary

    Constructors
    Constructor
    Description
    CharBucket(int bucketSize)
    Creates a bucket capable of holding a fixed number of characters
    CharBucket(int bucketSize, char fillWith)
    Creates a bucket capable of holding a fixed number of characters
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    fill(Reader reader)
    Fills the bucket with the characters take from a Reader
    boolean
    Returns true if the bucket is empty (i.e.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • data

      final char[] data
      The bucket data
    • length

      int length
      The number of characters this bucket contain. It is modified every time fill(Reader) is called.
  • Constructor Details

    • CharBucket

      public CharBucket(int bucketSize)
      Creates a bucket capable of holding a fixed number of characters
      Parameters:
      bucketSize - the maximum capacity of the bucket
    • CharBucket

      public CharBucket(int bucketSize, char fillWith)
      Creates a bucket capable of holding a fixed number of characters
      Parameters:
      bucketSize - the maximum capacity of the bucket
      fillWith - a character used to fill all positions of the bucket.
  • Method Details

    • fill

      public int fill(Reader reader) throws IOException
      Fills the bucket with the characters take from a Reader

      The length attribute will be updated with the number of characters extracted

      Parameters:
      reader - the source of characters used to fill the bucket
      Returns:
      the number of characters extracted from the reader
      Throws:
      IOException - if any error occurs while extracting characters from the reader
    • isEmpty

      public boolean isEmpty()
      Returns true if the bucket is empty (i.e. length <= 0), false otherwise.
      Returns:
      true if the bucket is empty (i.e. length <= 0), false otherwise.