class CharBucket
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
(package private) char[] |
data
The bucket data
|
(package private) int |
length
The number of characters this bucket contain.
|
Constructor and 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
|
Modifier and Type | Method and Description |
---|---|
int |
fill(java.io.Reader reader)
Fills the bucket with the characters take from a
Reader |
boolean |
isEmpty()
Returns true if the bucket is empty (i.e.
|
final char[] data
int length
fill(Reader)
is called.public CharBucket(int bucketSize)
bucketSize
- the maximum capacity of the bucketpublic CharBucket(int bucketSize, char fillWith)
bucketSize
- the maximum capacity of the bucketfillWith
- a character used to fill all positions of the bucket.public int fill(java.io.Reader reader) throws java.io.IOException
Reader
The length
attribute will be updated with the number of characters extracted
reader
- the source of characters used to fill the bucketjava.io.IOException
- if any error occurs while extracting characters from the readerpublic boolean isEmpty()