public final class StringPoolChunk extends Chunk
| Modifier and Type | Class and Description |
|---|---|
static class |
StringPoolChunk.StringPoolStyle
Represents all of the styles for a particular string.
|
Chunk.TypechunkSize, headerSize, METADATA_SIZE, offset, PAD_BOUNDARY| Modifier | Constructor and Description |
|---|---|
protected |
StringPoolChunk(java.nio.ByteBuffer buffer,
Chunk parent) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getString(int index)
Returns a string at the given (0-based) index.
|
int |
getStringCount()
Returns the number of strings in this pool.
|
BinaryResourceString.Type |
getStringType()
Returns the type of strings in this pool.
|
StringPoolChunk.StringPoolStyle |
getStyle(int index)
Returns a style at the given (0-based) index.
|
int |
getStyleCount()
Returns the number of styles in this pool.
|
protected Chunk.Type |
getType() |
int |
indexOf(java.lang.String string)
Returns the 0-based index of the first occurrence of the given string, or -1 if the string is
not in the pool.
|
protected void |
init(java.nio.ByteBuffer buffer)
Finishes initialization of a chunk.
|
boolean |
isSorted()
True if this string pool contains already-sorted strings.
|
boolean |
isUTF8()
True if this string pool contains strings in UTF-8 format.
|
protected void |
writeHeader(java.nio.ByteBuffer output)
Writes the remaining header (after the type,
headerSize, and chunkSize). |
protected void |
writePayload(java.io.DataOutput output,
java.nio.ByteBuffer header,
boolean shrink)
Writes the chunk payload.
|
getHeaderSize, getOriginalChunkSize, getParent, newInstance, newInstance, toByteArray, toByteArray, writeHeader, writePadprotected StringPoolChunk(java.nio.ByteBuffer buffer,
@Nullable
Chunk parent)
protected void init(java.nio.ByteBuffer buffer)
Chunkpublic int indexOf(java.lang.String string)
string - The string to check the pool for.public java.lang.String getString(int index)
index - The (0-based) index of the string to return.java.lang.IndexOutOfBoundsException - If the index is out of range (index < 0 || index >= size()).public int getStringCount()
public StringPoolChunk.StringPoolStyle getStyle(int index)
index - The (0-based) index of the style to return.java.lang.IndexOutOfBoundsException - If the index is out of range (index < 0 || index >= size()).public int getStyleCount()
public BinaryResourceString.Type getStringType()
protected Chunk.Type getType()
public boolean isUTF8()
public boolean isSorted()
protected void writeHeader(java.nio.ByteBuffer output)
ChunkheaderSize, and chunkSize).writeHeader in class Chunkoutput - The buffer that the header will be written to.protected void writePayload(java.io.DataOutput output,
java.nio.ByteBuffer header,
boolean shrink)
throws java.io.IOException
ChunkheaderSize bytes of the chunk.writePayload in class Chunkoutput - The stream that the payload will be written to.header - The already-written header. This can be modified to fix payload offsets.shrink - True if this payload should be optimized for size.java.io.IOException - Thrown if output could not be written to (out of memory).