public final class PackageChunk extends ChunkWithChunks
Chunk.TypechunkSize, headerSize, METADATA_SIZE, offset, PAD_BOUNDARY| Modifier | Constructor and Description |
|---|---|
protected |
PackageChunk(java.nio.ByteBuffer buffer,
Chunk parent) |
| Modifier and Type | Method and Description |
|---|---|
int |
getId()
Returns the package id if this is a base package, or 0 if not a base package.
|
StringPoolChunk |
getKeyStringPool()
Returns the string pool that contains the names of the resources in this package.
|
java.lang.String |
getPackageName()
Returns the name of this package.
|
protected Chunk.Type |
getType() |
java.util.Collection<TypeChunk> |
getTypeChunks()
Returns all
TypeChunk in this package. |
java.util.Collection<TypeChunk> |
getTypeChunks(int id)
For a given type id, returns the
TypeChunk objects that match that id. |
java.util.Collection<TypeChunk> |
getTypeChunks(java.lang.String type)
For a given type, returns the
TypeChunk objects that match that type
(e.g. |
TypeSpecChunk |
getTypeSpecChunk(int id)
For a given (1-based) type id, returns the
TypeSpecChunk matching it. |
TypeSpecChunk |
getTypeSpecChunk(java.lang.String type)
For a given
type, returns the TypeSpecChunk that matches it
(e.g. |
java.util.Collection<TypeSpecChunk> |
getTypeSpecChunks()
Returns all
TypeSpecChunk in this package. |
StringPoolChunk |
getTypeStringPool()
Returns the string pool that contains the type strings for this package, such as "layout",
"string", "color".
|
protected void |
init(java.nio.ByteBuffer buffer)
Finishes initialization of a chunk.
|
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.
|
getChunksgetHeaderSize, getOriginalChunkSize, getParent, newInstance, newInstance, toByteArray, toByteArray, writeHeader, writePadprotected PackageChunk(java.nio.ByteBuffer buffer,
@Nullable
Chunk parent)
protected void init(java.nio.ByteBuffer buffer)
Chunkinit in class ChunkWithChunksbuffer - The buffer that the payload will be initialized from.public int getId()
public StringPoolChunk getKeyStringPool()
public StringPoolChunk getTypeStringPool()
public java.util.Collection<TypeChunk> getTypeChunks()
TypeChunk in this package.public java.util.Collection<TypeChunk> getTypeChunks(int id)
TypeChunk objects that match that id. The type id is
the 1-based index of the type in the type string pool (returned by getTypeStringPool()).public java.util.Collection<TypeChunk> getTypeChunks(java.lang.String type)
TypeChunk objects that match that type
(e.g. "attr", "id", "string", ...).public java.util.Collection<TypeSpecChunk> getTypeSpecChunks()
TypeSpecChunk in this package.public TypeSpecChunk getTypeSpecChunk(int id)
TypeSpecChunk matching it.public TypeSpecChunk getTypeSpecChunk(java.lang.String type)
type, returns the TypeSpecChunk that matches it
(e.g. "attr", "id", "string", ...).public java.lang.String getPackageName()
protected Chunk.Type getType()
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 ChunkWithChunksoutput - 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).