Class CharBucket
java.lang.Object
com.univocity.parsers.common.input.concurrent.CharBucket
A buffer of characters.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCharBucket
(int bucketSize) Creates a bucket capable of holding a fixed number of charactersCharBucket
(int bucketSize, char fillWith) Creates a bucket capable of holding a fixed number of characters -
Method Summary
-
Field Details
-
data
final char[] dataThe bucket data -
length
int lengthThe number of characters this bucket contain. It is modified every timefill(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 bucketfillWith
- a character used to fill all positions of the bucket.
-
-
Method Details
-
fill
Fills the bucket with the characters take from aReader
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.
-