Class CharBucket
- java.lang.Object
-
- com.univocity.parsers.common.input.concurrent.CharBucket
-
class CharBucket extends java.lang.ObjectA buffer of characters.
-
-
Constructor Summary
Constructors Constructor Description CharBucket(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intfill(java.io.Reader reader)Fills the bucket with the characters take from aReaderbooleanisEmpty()Returns true if the bucket is empty (i.e.
-
-
-
Field Detail
-
data
final char[] data
The bucket data
-
length
int length
The number of characters this bucket contain. It is modified every timefill(Reader)is called.
-
-
Constructor Detail
-
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 Detail
-
fill
public int fill(java.io.Reader reader) throws java.io.IOExceptionFills the bucket with the characters take from aReaderThe
lengthattribute 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:
java.io.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.
-
-