public class BytesRefArrayWritable extends Object implements org.apache.hadoop.io.Writable, Comparable<BytesRefArrayWritable>
Each BytesRefArrayWritable holds instance has a valid field, which is the desired valid number of BytesRefWritable it holds. resetValid can reset the valid, but it will not care the underlying BytesRefWritable.
| Constructor and Description |
|---|
BytesRefArrayWritable()
Constructs an empty array with a capacity of ten.
|
BytesRefArrayWritable(int capacity)
Constructs an empty array with the specified capacity.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Removes all elements.
|
int |
compareTo(BytesRefArrayWritable other) |
protected void |
ensureCapacity(int newCapacity) |
boolean |
equals(Object o) |
BytesRefWritable |
get(int index)
Gets the BytesRefWritable at the specified position.
|
void |
readFields(DataInput in) |
void |
resetValid(int newValidCapacity)
enlarge the capacity if necessary, to ensure that it can hold the number of
elements specified by newValidCapacity argument.
|
void |
set(int index,
BytesRefWritable bytesRefWritable)
Set the BytesRefWritable at the specified position with the specified
BytesRefWritable.
|
int |
size()
Returns the number of valid elements.
|
BytesRefWritable |
unCheckedGet(int index)
Gets the BytesRefWritable at the specified position without checking.
|
void |
write(DataOutput out) |
public BytesRefArrayWritable(int capacity)
capacity - initial capacityIllegalArgumentException - if the specified initial capacity is negativepublic BytesRefArrayWritable()
public int size()
public BytesRefWritable get(int index)
index - the position index, starting from zeroIndexOutOfBoundsExceptionpublic BytesRefWritable unCheckedGet(int index)
index - the position index, starting from zeroIndexOutOfBoundsExceptionpublic void set(int index,
BytesRefWritable bytesRefWritable)
index - index positionbytesRefWritable - the new elementIllegalArgumentException - if the specified new element is nullpublic int compareTo(BytesRefArrayWritable other)
compareTo in interface Comparable<BytesRefArrayWritable>public void clear()
public void resetValid(int newValidCapacity)
newValidCapacity - the desired capacityprotected void ensureCapacity(int newCapacity)
public void readFields(DataInput in) throws IOException
readFields in interface org.apache.hadoop.io.WritableIOExceptionpublic void write(DataOutput out) throws IOException
write in interface org.apache.hadoop.io.WritableIOExceptionCopyright © 2019 The Apache Software Foundation. All Rights Reserved.