Class TypeChunk.Entry

    • 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 the TypeChunk.Entry.
      • flags

        public int flags()
        Resource entry flags.
      • value

        @Nullable
        public BinaryResourceValue value()
        The value of this resource entry, if this is not a complex entry. Else, null.
      • parentEntry

        public int parentEntry()
        Entry into PackageChunk that is the parent TypeChunk.Entry to 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 this TypeChunk.Entry takes 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 new TypeChunk.Entry whose contents start at the 0-based position in buffer given by a 4-byte value read from buffer and then added to baseOffset. If the value read from buffer is equal to NO_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 an TypeChunk.Entry.
        baseOffset - Offset that must be added to the value at buffer's position.
        parent - The TypeChunk that this resource entry belongs to.
        Returns:
        New TypeChunk.Entry or null if there is no resource at this location.
      • toByteArray

        public final byte[] toByteArray()
        Description copied from interface: SerializableResource
        Converts this resource into an array of bytes representation.
        Specified by:
        toByteArray in interface SerializableResource
        Returns:
        An array of bytes representing this resource.
      • toByteArray

        public final byte[] toByteArray​(boolean shrink)
        Description copied from interface: SerializableResource
        Converts this resource into an array of bytes representation.
        Specified by:
        toByteArray in interface SerializableResource
        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:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object