public class StringHashTableDictionary extends Object implements Dictionary
This implementation is not thread-safe.
Dictionary.IMPL, Dictionary.Visitor, Dictionary.VisitorContext
INITIAL_DICTIONARY_SIZE
Constructor and Description |
---|
StringHashTableDictionary(int initialCapacity) |
StringHashTableDictionary(int initialCapacity,
float loadFactor) |
Modifier and Type | Method and Description |
---|---|
int |
add(byte[] bytes,
int offset,
int length) |
int |
add(Text text) |
void |
clear() |
long |
getSizeInBytes() |
ByteBuffer |
getText(int positionInKeyOffset) |
void |
getText(Text result,
int positionInKeyOffset)
Given the position index, return the original string before being encoded.
|
int |
size() |
void |
visit(Dictionary.Visitor visitor)
Traverse the whole dictionary and apply the action.
|
int |
writeTo(OutputStream out,
int position)
Given the position index, write the original string, before being encoded,
to the OutputStream.
|
public StringHashTableDictionary(int initialCapacity)
public StringHashTableDictionary(int initialCapacity, float loadFactor)
public void visit(Dictionary.Visitor visitor) throws IOException
Dictionary
visit
in interface Dictionary
IOException
public void clear()
clear
in interface Dictionary
public void getText(Text result, int positionInKeyOffset)
Dictionary
result
.getText
in interface Dictionary
result
- the holder to copy the dictionary text intopositionInKeyOffset
- the position where the key was addedpublic ByteBuffer getText(int positionInKeyOffset)
getText
in interface Dictionary
public int writeTo(OutputStream out, int position) throws IOException
Dictionary
writeTo
in interface Dictionary
out
- the output stream to which to write the dataposition
- the position where the key was originally addedIOException
- if an I/O error occurspublic int add(Text text)
public int add(byte[] bytes, int offset, int length)
add
in interface Dictionary
public int size()
size
in interface Dictionary
public long getSizeInBytes()
getSizeInBytes
in interface Dictionary
Copyright © 2013–2023 The Apache Software Foundation. All rights reserved.