Class XmlNodeChunk
- java.lang.Object
-
- com.google.devrel.gmscore.tools.apk.arsc.Chunk
-
- com.google.devrel.gmscore.tools.apk.arsc.XmlNodeChunk
-
- All Implemented Interfaces:
SerializableResource
- Direct Known Subclasses:
XmlCdataChunk,XmlEndElementChunk,XmlNamespaceChunk,XmlStartElementChunk
public abstract class XmlNodeChunk extends Chunk
The common superclass for the various types of XML nodes.
-
-
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 protectedXmlNodeChunk(java.nio.ByteBuffer buffer, Chunk parent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetComment()Returns the comment associated with this node, if any.intgetLineNumber()Returns the line number in the original source at which this node appeared.protected java.lang.StringgetString(int index)AnXmlNodeChunkdoes not know by itself what strings its indices reference.booleanhasComment()Returns true if this XML node contains a comment.java.lang.StringtoString()Returns a brief description of this XML node.protected voidwriteHeader(java.nio.ByteBuffer output)AnXmlNodeChunkand anything that is itself anXmlNodeChunkhas a header size of 16.-
Methods inherited from class com.google.devrel.gmscore.tools.apk.arsc.Chunk
getHeaderSize, getOriginalChunkSize, getParent, getType, init, newInstance, newInstance, toByteArray, toByteArray, writeHeader, writePad, writePayload
-
-
-
-
Constructor Detail
-
XmlNodeChunk
protected XmlNodeChunk(java.nio.ByteBuffer buffer, @Nullable Chunk parent)
-
-
Method Detail
-
hasComment
public boolean hasComment()
Returns true if this XML node contains a comment. Else, returns false.
-
getLineNumber
public int getLineNumber()
Returns the line number in the original source at which this node appeared.
-
getComment
public java.lang.String getComment()
Returns the comment associated with this node, if any. Else, returns the empty string.
-
getString
protected java.lang.String getString(int index)
AnXmlNodeChunkdoes not know by itself what strings its indices reference. In order to get the actual string, the firstXmlChunkancestor is found. TheXmlChunkancestor should have a string pool whichindexreferences.- Parameters:
index- The index of the string.- Returns:
- String that the given
indexreferences, or empty string ifindexis -1.
-
writeHeader
protected final void writeHeader(java.nio.ByteBuffer output)
AnXmlNodeChunkand anything that is itself anXmlNodeChunkhas a header size of 16. Anything else is, interestingly, considered to be a payload. For that reason, this method is final.- Overrides:
writeHeaderin classChunk- Parameters:
output- The buffer that the header will be written to.
-
toString
public java.lang.String toString()
Returns a brief description of this XML node. The representation of this information is subject to change, but below is a typical example:"XmlNodeChunk{line=1234, comment=My awesome comment.}"- Overrides:
toStringin classjava.lang.Object
-
-