Class ChunkWithChunks
- java.lang.Object
-
- com.google.devrel.gmscore.tools.apk.arsc.Chunk
-
- com.google.devrel.gmscore.tools.apk.arsc.ChunkWithChunks
-
- All Implemented Interfaces:
SerializableResource
- Direct Known Subclasses:
PackageChunk,ResourceTableChunk,XmlChunk
public abstract class ChunkWithChunks extends Chunk
Represents a chunk whose payload is a list of sub-chunks.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.devrel.gmscore.tools.apk.arsc.Chunk
Chunk.Type
-
-
Field Summary
-
Fields inherited from class com.google.devrel.gmscore.tools.apk.arsc.Chunk
chunkSize, headerSize, METADATA_SIZE, offset, PAD_BOUNDARY
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedChunkWithChunks(java.nio.ByteBuffer buffer, Chunk parent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<java.lang.Integer,Chunk>getChunks()Retrieves the @{code chunks} contained in this chunk.protected voidinit(java.nio.ByteBuffer buffer)Finishes initialization of a chunk.protected voidwritePayload(java.io.DataOutput output, java.nio.ByteBuffer header, boolean shrink)Writes the chunk payload.-
Methods inherited from class com.google.devrel.gmscore.tools.apk.arsc.Chunk
getHeaderSize, getOriginalChunkSize, getParent, getType, newInstance, newInstance, toByteArray, toByteArray, writeHeader, writeHeader, writePad
-
-
-
-
Constructor Detail
-
ChunkWithChunks
protected ChunkWithChunks(java.nio.ByteBuffer buffer, @Nullable Chunk parent)
-
-
Method Detail
-
init
protected void init(java.nio.ByteBuffer buffer)
Description copied from class:ChunkFinishes initialization of a chunk. This should be called immediately after the constructor. This is separate from the constructor so that the header of a chunk can be fully initialized before the payload of that chunk is initialized for chunks that require such behavior.
-
getChunks
public final java.util.Map<java.lang.Integer,Chunk> getChunks()
Retrieves the @{code chunks} contained in this chunk.- Returns:
- map of buffer offset -> chunk contained in this chunk.
-
writePayload
protected void writePayload(java.io.DataOutput output, java.nio.ByteBuffer header, boolean shrink) throws java.io.IOExceptionDescription copied from class:ChunkWrites the chunk payload. The payload is data in a chunk which is not in the firstheaderSizebytes of the chunk.- Overrides:
writePayloadin classChunk- Parameters:
output- 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.- Throws:
java.io.IOException- Thrown ifoutputcould not be written to (out of memory).
-
-