Class TypeChunk.Entry
- java.lang.Object
-
- com.google.devrel.gmscore.tools.apk.arsc.TypeChunk.Entry
-
- All Implemented Interfaces:
SerializableResource
- Enclosing class:
- TypeChunk
public static class TypeChunk.Entry extends java.lang.Object implements SerializableResource
-
-
Field Summary
Fields Modifier and Type Field Description static intNO_ENTRYAn entry offset that indicates that a given resource is not present.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static TypeChunk.Entrycreate(java.nio.ByteBuffer buffer, int baseOffset, TypeChunk parent)Creates a newTypeChunk.Entrywhose contents start at the 0-based position inbuffergiven by a 4-byte value read frombufferand then added tobaseOffset.booleanequals(java.lang.Object o)intflags()Resource entry flags.inthashCode()intheaderSize()Number of bytes in the header of theTypeChunk.Entry.booleanisComplex()Returns true if this is a complex resource.java.lang.Stringkey()Returns the key name identifying this resource entry.intkeyIndex()Index intoPackageChunk.getKeyStringPool()identifying this entry.TypeChunkparent()TheTypeChunkthat this resource entry belongs to.intparentEntry()Entry intoPackageChunkthat is the parentTypeChunk.Entryto this entry.intsize()The total number of bytes that thisTypeChunk.Entrytakes up.byte[]toByteArray()Converts this resource into an array of bytes representation.byte[]toByteArray(boolean shrink)Converts this resource into an array of bytes representation.java.lang.StringtoString()java.lang.StringtypeName()Returns the name of the type this chunk represents (e.g.BinaryResourceValuevalue()The value of this resource entry, if this is not a complex entry.java.util.Map<java.lang.Integer,BinaryResourceValue>values()The extra values in this resource entry if thisisComplex().
-
-
-
Field Detail
-
NO_ENTRY
public static final int NO_ENTRY
An entry offset that indicates that a given resource is not present.- See Also:
- Constant Field Values
-
-
Method Detail
-
headerSize
public int headerSize()
Number of bytes in the header of theTypeChunk.Entry.
-
flags
public int flags()
Resource entry flags.
-
keyIndex
public int keyIndex()
Index intoPackageChunk.getKeyStringPool()identifying this entry.
-
value
@Nullable public BinaryResourceValue value()
The value of this resource entry, if this is not a complex entry. Else, null.
-
values
public java.util.Map<java.lang.Integer,BinaryResourceValue> values()
The extra values in this resource entry if thisisComplex().
-
parentEntry
public int parentEntry()
Entry intoPackageChunkthat is the parentTypeChunk.Entryto this entry. This value only makes sense when this is complex (isComplex()returns true).
-
typeName
public final java.lang.String typeName()
Returns the name of the type this chunk represents (e.g. string, attr, id).
-
size
public final int size()
The total number of bytes that thisTypeChunk.Entrytakes up.
-
key
public final java.lang.String key()
Returns the key name identifying this resource entry.
-
isComplex
public final boolean isComplex()
Returns true if this is a complex resource.
-
create
@Nullable public static TypeChunk.Entry create(java.nio.ByteBuffer buffer, int baseOffset, TypeChunk parent)
Creates a newTypeChunk.Entrywhose contents start at the 0-based position inbuffergiven by a 4-byte value read frombufferand then added tobaseOffset. If the value read frombufferis equal toNO_ENTRY, then null is returned as there is no resource at that position.Otherwise, this position is parsed and returned as an
TypeChunk.Entry.- Parameters:
buffer- A buffer positioned at an offset to anTypeChunk.Entry.baseOffset- Offset that must be added to the value atbuffer's position.parent- TheTypeChunkthat this resource entry belongs to.- Returns:
- New
TypeChunk.Entryor null if there is no resource at this location.
-
toByteArray
public final byte[] toByteArray()
Description copied from interface:SerializableResourceConverts this resource into an array of bytes representation.- Specified by:
toByteArrayin interfaceSerializableResource- Returns:
- An array of bytes representing this resource.
-
toByteArray
public final byte[] toByteArray(boolean shrink)
Description copied from interface:SerializableResourceConverts this resource into an array of bytes representation.- Specified by:
toByteArrayin interfaceSerializableResource- Parameters:
shrink- True if, when converting to a byte array, this resource can modify the returned bytes in an effort to reduce the size.- Returns:
- An array of bytes representing this resource.
-
toString
public final java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-