Top Description Fields Constructors Methods
com.univocity.parsers.common.input.concurrent

pack-priv Class CharBucket

extends Object
Class Inheritance
Imports
java.io.*, java.util.*

A buffer of characters.
Author
Univocity Software Pty Ltd - [email protected]

Field Summary

Modifier and TypeField and Description
pack-priv final char[]
data

The bucket data

pack-priv int
length

The number of characters this bucket contain.

Constructor Summary

AccessConstructor and Description
public
CharBucket(int
the maximum capacity of the bucket
bucketSize
)

Creates a bucket capable of holding a fixed number of characters

public
CharBucket(int
the maximum capacity of the bucket
bucketSize
,
char
a character used to fill all positions of the bucket.
fillWith
)

Creates a bucket capable of holding a fixed number of characters

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

the number of characters extracted from the reader
fill
(Reader
the source of characters used to fill the bucket
reader
)

Fills the bucket with the characters take from a java.io.Reader

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

public boolean

Returns:

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

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

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

databack to summary
pack-priv final char[] data

The bucket data

lengthback to summary
pack-priv int length

The number of characters this bucket contain. It is modified every time CharBucket#fill(Reader) is called.

Constructor Detail

CharBucketback to summary
public CharBucket(int bucketSize)

Creates a bucket capable of holding a fixed number of characters

Parameters
bucketSize:int

the maximum capacity of the bucket

CharBucketback to summary
public CharBucket(int bucketSize, char fillWith)

Creates a bucket capable of holding a fixed number of characters

Parameters
bucketSize:int

the maximum capacity of the bucket

fillWith:char

a character used to fill all positions of the bucket.

Method Detail

fillback to summary
public int fill(Reader reader) throws IOException

Fills the bucket with the characters take from a java.io.Reader

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

Parameters
reader:Reader

the source of characters used to fill the bucket

Returns:int

the number of characters extracted from the reader

Exceptions
IOException:
if any error occurs while extracting characters from the reader
isEmptyback to summary
public boolean isEmpty()

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

Returns:boolean

true if the bucket is empty (i.e. length <= 0), false otherwise.