brut.androlib.res.decoder
Class AXmlResourceParser

java.lang.Object
  extended by brut.androlib.res.decoder.AXmlResourceParser
All Implemented Interfaces:
android.content.res.XmlResourceParser, android.util.AttributeSet, org.xmlpull.v1.XmlPullParser

public class AXmlResourceParser
extends Object
implements android.content.res.XmlResourceParser

Author:
Ryszard Wiśniewski , Dmitry Skiba Binary xml files parser. Parser has only two states: (1) Operational state, which parser obtains after first successful call to next() and retains until open(), close(), or failed call to next(). (2) Closed state, which parser obtains after open(), close(), or failed call to next(). In this state methods return invalid values or throw exceptions. TODO: * check all methods in closed state

Field Summary
 
Fields inherited from interface org.xmlpull.v1.XmlPullParser
CDSECT, COMMENT, DOCDECL, END_DOCUMENT, END_TAG, ENTITY_REF, FEATURE_PROCESS_DOCDECL, FEATURE_PROCESS_NAMESPACES, FEATURE_REPORT_NAMESPACE_ATTRIBUTES, FEATURE_VALIDATION, IGNORABLE_WHITESPACE, NO_NAMESPACE, PROCESSING_INSTRUCTION, START_DOCUMENT, START_TAG, TEXT, TYPES
 
Constructor Summary
AXmlResourceParser()
           
AXmlResourceParser(InputStream stream)
           
 
Method Summary
 void close()
           
 void defineEntityReplacementText(String entityName, String replacementText)
           
 ResAttrDecoder getAttrDecoder()
           
 boolean getAttributeBooleanValue(int index, boolean defaultValue)
           
 boolean getAttributeBooleanValue(String namespace, String attribute, boolean defaultValue)
           
 int getAttributeCount()
           
 float getAttributeFloatValue(int index, float defaultValue)
           
 float getAttributeFloatValue(String namespace, String attribute, float defaultValue)
           
 int getAttributeIntValue(int index, int defaultValue)
           
 int getAttributeIntValue(String namespace, String attribute, int defaultValue)
           
 int getAttributeListValue(int index, String[] options, int defaultValue)
           
 int getAttributeListValue(String namespace, String attribute, String[] options, int defaultValue)
           
 String getAttributeName(int index)
           
 int getAttributeNameResource(int index)
           
 String getAttributeNamespace(int index)
           
 String getAttributePrefix(int index)
           
 int getAttributeResourceValue(int index, int defaultValue)
           
 int getAttributeResourceValue(String namespace, String attribute, int defaultValue)
           
 String getAttributeType(int index)
           
 int getAttributeUnsignedIntValue(int index, int defaultValue)
           
 int getAttributeUnsignedIntValue(String namespace, String attribute, int defaultValue)
           
 String getAttributeValue(int index)
           
 String getAttributeValue(String namespace, String attribute)
           
 int getAttributeValueData(int index)
           
 int getAttributeValueType(int index)
           
 String getClassAttribute()
           
 int getColumnNumber()
           
 int getDepth()
           
 int getEventType()
           
 boolean getFeature(String feature)
           
 AndrolibException getFirstError()
           
 String getIdAttribute()
           
 int getIdAttributeResourceValue(int defaultValue)
           
 String getInputEncoding()
           
 int getLineNumber()
           
 String getName()
           
 String getNamespace()
           
 String getNamespace(String prefix)
           
 int getNamespaceCount(int depth)
           
 String getNamespacePrefix(int pos)
           
 String getNamespaceUri(int pos)
           
 String getPositionDescription()
           
 String getPrefix()
           
 Object getProperty(String name)
           
 int getStyleAttribute()
           
 String getText()
           
 char[] getTextCharacters(int[] holderForStartAndLength)
           
 boolean isAttributeDefault(int index)
           
 boolean isEmptyElementTag()
           
 boolean isWhitespace()
           
 int next()
           
 int nextTag()
           
 String nextText()
           
 int nextToken()
           
 void open(InputStream stream)
           
 void require(int type, String namespace, String name)
           
 void setAttrDecoder(ResAttrDecoder attrDecoder)
           
 void setFeature(String name, boolean value)
           
 void setInput(InputStream stream, String inputEncoding)
           
 void setInput(Reader reader)
           
 void setProperty(String name, Object value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AXmlResourceParser

public AXmlResourceParser()

AXmlResourceParser

public AXmlResourceParser(InputStream stream)
Method Detail

getFirstError

public AndrolibException getFirstError()

getAttrDecoder

public ResAttrDecoder getAttrDecoder()

setAttrDecoder

public void setAttrDecoder(ResAttrDecoder attrDecoder)

open

public void open(InputStream stream)

close

public void close()
Specified by:
close in interface android.content.res.XmlResourceParser

next

public int next()
         throws org.xmlpull.v1.XmlPullParserException,
                IOException
Specified by:
next in interface org.xmlpull.v1.XmlPullParser
Throws:
org.xmlpull.v1.XmlPullParserException
IOException

nextToken

public int nextToken()
              throws org.xmlpull.v1.XmlPullParserException,
                     IOException
Specified by:
nextToken in interface org.xmlpull.v1.XmlPullParser
Throws:
org.xmlpull.v1.XmlPullParserException
IOException

nextTag

public int nextTag()
            throws org.xmlpull.v1.XmlPullParserException,
                   IOException
Specified by:
nextTag in interface org.xmlpull.v1.XmlPullParser
Throws:
org.xmlpull.v1.XmlPullParserException
IOException

nextText

public String nextText()
                throws org.xmlpull.v1.XmlPullParserException,
                       IOException
Specified by:
nextText in interface org.xmlpull.v1.XmlPullParser
Throws:
org.xmlpull.v1.XmlPullParserException
IOException

require

public void require(int type,
                    String namespace,
                    String name)
             throws org.xmlpull.v1.XmlPullParserException,
                    IOException
Specified by:
require in interface org.xmlpull.v1.XmlPullParser
Throws:
org.xmlpull.v1.XmlPullParserException
IOException

getDepth

public int getDepth()
Specified by:
getDepth in interface org.xmlpull.v1.XmlPullParser

getEventType

public int getEventType()
                 throws org.xmlpull.v1.XmlPullParserException
Specified by:
getEventType in interface org.xmlpull.v1.XmlPullParser
Throws:
org.xmlpull.v1.XmlPullParserException

getLineNumber

public int getLineNumber()
Specified by:
getLineNumber in interface org.xmlpull.v1.XmlPullParser

getName

public String getName()
Specified by:
getName in interface org.xmlpull.v1.XmlPullParser

getText

public String getText()
Specified by:
getText in interface org.xmlpull.v1.XmlPullParser

getTextCharacters

public char[] getTextCharacters(int[] holderForStartAndLength)
Specified by:
getTextCharacters in interface org.xmlpull.v1.XmlPullParser

getNamespace

public String getNamespace()
Specified by:
getNamespace in interface org.xmlpull.v1.XmlPullParser

getPrefix

public String getPrefix()
Specified by:
getPrefix in interface org.xmlpull.v1.XmlPullParser

getPositionDescription

public String getPositionDescription()
Specified by:
getPositionDescription in interface android.util.AttributeSet
Specified by:
getPositionDescription in interface org.xmlpull.v1.XmlPullParser

getNamespaceCount

public int getNamespaceCount(int depth)
                      throws org.xmlpull.v1.XmlPullParserException
Specified by:
getNamespaceCount in interface org.xmlpull.v1.XmlPullParser
Throws:
org.xmlpull.v1.XmlPullParserException

getNamespacePrefix

public String getNamespacePrefix(int pos)
                          throws org.xmlpull.v1.XmlPullParserException
Specified by:
getNamespacePrefix in interface org.xmlpull.v1.XmlPullParser
Throws:
org.xmlpull.v1.XmlPullParserException

getNamespaceUri

public String getNamespaceUri(int pos)
                       throws org.xmlpull.v1.XmlPullParserException
Specified by:
getNamespaceUri in interface org.xmlpull.v1.XmlPullParser
Throws:
org.xmlpull.v1.XmlPullParserException

getClassAttribute

public String getClassAttribute()
Specified by:
getClassAttribute in interface android.util.AttributeSet

getIdAttribute

public String getIdAttribute()
Specified by:
getIdAttribute in interface android.util.AttributeSet

getIdAttributeResourceValue

public int getIdAttributeResourceValue(int defaultValue)
Specified by:
getIdAttributeResourceValue in interface android.util.AttributeSet

getStyleAttribute

public int getStyleAttribute()
Specified by:
getStyleAttribute in interface android.util.AttributeSet

getAttributeCount

public int getAttributeCount()
Specified by:
getAttributeCount in interface android.util.AttributeSet
Specified by:
getAttributeCount in interface org.xmlpull.v1.XmlPullParser

getAttributeNamespace

public String getAttributeNamespace(int index)
Specified by:
getAttributeNamespace in interface org.xmlpull.v1.XmlPullParser

getAttributePrefix

public String getAttributePrefix(int index)
Specified by:
getAttributePrefix in interface org.xmlpull.v1.XmlPullParser

getAttributeName

public String getAttributeName(int index)
Specified by:
getAttributeName in interface android.util.AttributeSet
Specified by:
getAttributeName in interface org.xmlpull.v1.XmlPullParser

getAttributeNameResource

public int getAttributeNameResource(int index)
Specified by:
getAttributeNameResource in interface android.util.AttributeSet

getAttributeValueType

public int getAttributeValueType(int index)

getAttributeValueData

public int getAttributeValueData(int index)

getAttributeValue

public String getAttributeValue(int index)
Specified by:
getAttributeValue in interface android.util.AttributeSet
Specified by:
getAttributeValue in interface org.xmlpull.v1.XmlPullParser

getAttributeBooleanValue

public boolean getAttributeBooleanValue(int index,
                                        boolean defaultValue)
Specified by:
getAttributeBooleanValue in interface android.util.AttributeSet

getAttributeFloatValue

public float getAttributeFloatValue(int index,
                                    float defaultValue)
Specified by:
getAttributeFloatValue in interface android.util.AttributeSet

getAttributeIntValue

public int getAttributeIntValue(int index,
                                int defaultValue)
Specified by:
getAttributeIntValue in interface android.util.AttributeSet

getAttributeUnsignedIntValue

public int getAttributeUnsignedIntValue(int index,
                                        int defaultValue)
Specified by:
getAttributeUnsignedIntValue in interface android.util.AttributeSet

getAttributeResourceValue

public int getAttributeResourceValue(int index,
                                     int defaultValue)
Specified by:
getAttributeResourceValue in interface android.util.AttributeSet

getAttributeValue

public String getAttributeValue(String namespace,
                                String attribute)
Specified by:
getAttributeValue in interface android.util.AttributeSet
Specified by:
getAttributeValue in interface org.xmlpull.v1.XmlPullParser

getAttributeBooleanValue

public boolean getAttributeBooleanValue(String namespace,
                                        String attribute,
                                        boolean defaultValue)
Specified by:
getAttributeBooleanValue in interface android.util.AttributeSet

getAttributeFloatValue

public float getAttributeFloatValue(String namespace,
                                    String attribute,
                                    float defaultValue)
Specified by:
getAttributeFloatValue in interface android.util.AttributeSet

getAttributeIntValue

public int getAttributeIntValue(String namespace,
                                String attribute,
                                int defaultValue)
Specified by:
getAttributeIntValue in interface android.util.AttributeSet

getAttributeUnsignedIntValue

public int getAttributeUnsignedIntValue(String namespace,
                                        String attribute,
                                        int defaultValue)
Specified by:
getAttributeUnsignedIntValue in interface android.util.AttributeSet

getAttributeResourceValue

public int getAttributeResourceValue(String namespace,
                                     String attribute,
                                     int defaultValue)
Specified by:
getAttributeResourceValue in interface android.util.AttributeSet

getAttributeListValue

public int getAttributeListValue(int index,
                                 String[] options,
                                 int defaultValue)
Specified by:
getAttributeListValue in interface android.util.AttributeSet

getAttributeListValue

public int getAttributeListValue(String namespace,
                                 String attribute,
                                 String[] options,
                                 int defaultValue)
Specified by:
getAttributeListValue in interface android.util.AttributeSet

getAttributeType

public String getAttributeType(int index)
Specified by:
getAttributeType in interface org.xmlpull.v1.XmlPullParser

isAttributeDefault

public boolean isAttributeDefault(int index)
Specified by:
isAttributeDefault in interface org.xmlpull.v1.XmlPullParser

setInput

public void setInput(InputStream stream,
                     String inputEncoding)
              throws org.xmlpull.v1.XmlPullParserException
Specified by:
setInput in interface org.xmlpull.v1.XmlPullParser
Throws:
org.xmlpull.v1.XmlPullParserException

setInput

public void setInput(Reader reader)
              throws org.xmlpull.v1.XmlPullParserException
Specified by:
setInput in interface org.xmlpull.v1.XmlPullParser
Throws:
org.xmlpull.v1.XmlPullParserException

getInputEncoding

public String getInputEncoding()
Specified by:
getInputEncoding in interface org.xmlpull.v1.XmlPullParser

getColumnNumber

public int getColumnNumber()
Specified by:
getColumnNumber in interface org.xmlpull.v1.XmlPullParser

isEmptyElementTag

public boolean isEmptyElementTag()
                          throws org.xmlpull.v1.XmlPullParserException
Specified by:
isEmptyElementTag in interface org.xmlpull.v1.XmlPullParser
Throws:
org.xmlpull.v1.XmlPullParserException

isWhitespace

public boolean isWhitespace()
                     throws org.xmlpull.v1.XmlPullParserException
Specified by:
isWhitespace in interface org.xmlpull.v1.XmlPullParser
Throws:
org.xmlpull.v1.XmlPullParserException

defineEntityReplacementText

public void defineEntityReplacementText(String entityName,
                                        String replacementText)
                                 throws org.xmlpull.v1.XmlPullParserException
Specified by:
defineEntityReplacementText in interface org.xmlpull.v1.XmlPullParser
Throws:
org.xmlpull.v1.XmlPullParserException

getNamespace

public String getNamespace(String prefix)
Specified by:
getNamespace in interface org.xmlpull.v1.XmlPullParser

getProperty

public Object getProperty(String name)
Specified by:
getProperty in interface org.xmlpull.v1.XmlPullParser

setProperty

public void setProperty(String name,
                        Object value)
                 throws org.xmlpull.v1.XmlPullParserException
Specified by:
setProperty in interface org.xmlpull.v1.XmlPullParser
Throws:
org.xmlpull.v1.XmlPullParserException

getFeature

public boolean getFeature(String feature)
Specified by:
getFeature in interface org.xmlpull.v1.XmlPullParser

setFeature

public void setFeature(String name,
                       boolean value)
                throws org.xmlpull.v1.XmlPullParserException
Specified by:
setFeature in interface org.xmlpull.v1.XmlPullParser
Throws:
org.xmlpull.v1.XmlPullParserException


Copyright © 2012. All Rights Reserved.