package android.content.res;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
/* loaded from: AXMLPrinter.jar:android/content/res/AXmlResourceParser.class */
public class AXmlResourceParser implements XmlResourceParser {
private IntReader m_reader;
private StringBlock m_strings;
private int[] m_resourceIDs;
private boolean m_decreaseDepth;
private int m_event;
private int m_lineNumber;
private int m_name;
private int m_namespaceUri;
private int[] m_attributes;
private int m_idAttribute;
private int m_classAttribute;
private int m_styleAttribute;
private static final String E_NOT_SUPPORTED = "Method is not supported.";
private static final int ATTRIBUTE_IX_NAMESPACE_URI = 0;
private static final int ATTRIBUTE_IX_NAME = 1;
private static final int ATTRIBUTE_IX_VALUE_STRING = 2;
private static final int ATTRIBUTE_IX_VALUE_TYPE = 3;
private static final int ATTRIBUTE_IX_VALUE_DATA = 4;
private static final int ATTRIBUTE_LENGHT = 5;
private static final int CHUNK_AXML_FILE = 524291;
private static final int CHUNK_RESOURCEIDS = 524672;
private static final int CHUNK_XML_FIRST = 1048832;
private static final int CHUNK_XML_START_NAMESPACE = 1048832;
private static final int CHUNK_XML_END_NAMESPACE = 1048833;
private static final int CHUNK_XML_START_TAG = 1048834;
private static final int CHUNK_XML_END_TAG = 1048835;
private static final int CHUNK_XML_TEXT = 1048836;
private static final int CHUNK_XML_LAST = 1048836;
private boolean m_operational = false;
private NamespaceStack m_namespaces = new NamespaceStack();
public AXmlResourceParser() {
resetEventInfo();
}
public void open(InputStream stream) {
close();
if (stream != null) {
this.m_reader = new IntReader(stream, false);
}
}
@Override // android.content.res.XmlResourceParser
public void close() {
if (this.m_operational) {
this.m_operational = false;
this.m_reader.close();
this.m_reader = null;
this.m_strings = null;
this.m_resourceIDs = null;
this.m_namespaces.reset();
resetEventInfo();
}
}
@Override // org.xmlpull.v1.XmlPullParser
public int next() throws XmlPullParserException, IOException {
if (this.m_reader == null) {
throw new XmlPullParserException("Parser is not opened.", this, null);
}
try {
doNext();
return this.m_event;
} catch (IOException e) {
close();
throw e;
}
}
@Override // org.xmlpull.v1.XmlPullParser
public int nextToken() throws XmlPullParserException, IOException {
return next();
}
@Override // org.xmlpull.v1.XmlPullParser
public int nextTag() throws XmlPullParserException, IOException {
int eventType = next();
if (eventType == 4 && isWhitespace()) {
eventType = next();
}
if (eventType == 2 || eventType == 3) {
return eventType;
}
throw new XmlPullParserException("Expected start or end tag.", this, null);
}
@Override // org.xmlpull.v1.XmlPullParser
public String nextText() throws XmlPullParserException, IOException {
if (getEventType() != 2) {
throw new XmlPullParserException("Parser must be on START_TAG to read next text.", this, null);
}
int eventType = next();
if (eventType == 4) {
String result = getText();
if (next() == 3) {
return result;
}
throw new XmlPullParserException("Event TEXT must be immediately followed by END_TAG.", this, null);
} else if (eventType == 3) {
return XmlPullParser.NO_NAMESPACE;
} else {
throw new XmlPullParserException("Parser must be on START_TAG or TEXT to read text.", this, null);
}
}
@Override // org.xmlpull.v1.XmlPullParser
public void require(int type, String namespace, String name) throws XmlPullParserException, IOException {
if (type != getEventType() || ((namespace != null && !namespace.equals(getNamespace()))
|| (name != null && !name.equals(getName())))) {
throw new XmlPullParserException(String.valueOf(TYPES[type]) + " is expected.", this, null);
}
}
@Override // org.xmlpull.v1.XmlPullParser
public int getDepth() {
return this.m_namespaces.getDepth() - 1;
}
@Override // org.xmlpull.v1.XmlPullParser
public int getEventType() throws XmlPullParserException {
return this.m_event;
}
@Override // org.xmlpull.v1.XmlPullParser
public int getLineNumber() {
return this.m_lineNumber;
}
@Override // org.xmlpull.v1.XmlPullParser
public String getName() {
if (this.m_name == -1) {
return null;
}
if (this.m_event == 2 || this.m_event == 3) {
return this.m_strings.getString(this.m_name);
}
return null;
}
@Override // org.xmlpull.v1.XmlPullParser
public String getText() {
if (this.m_name == -1 || this.m_event != 4) {
return null;
}
return this.m_strings.getString(this.m_name);
}
@Override // org.xmlpull.v1.XmlPullParser
public char[] getTextCharacters(int[] holderForStartAndLength) {
String text = getText();
if (text == null) {
return null;
}
holderForStartAndLength[0] = 0;
holderForStartAndLength[1] = text.length();
char[] chars = new char[text.length()];
text.getChars(0, text.length(), chars, 0);
return chars;
}
@Override // org.xmlpull.v1.XmlPullParser
public String getNamespace() {
return this.m_strings.getString(this.m_namespaceUri);
}
@Override // org.xmlpull.v1.XmlPullParser
public String getPrefix() {
int prefix = this.m_namespaces.findPrefix(this.m_namespaceUri);
return this.m_strings.getString(prefix);
}
@Override // org.xmlpull.v1.XmlPullParser, android.util.AttributeSet
public String getPositionDescription() {
return "XML line #" + getLineNumber();
}
@Override // org.xmlpull.v1.XmlPullParser
public int getNamespaceCount(int depth) throws XmlPullParserException {
return this.m_namespaces.getAccumulatedCount(depth);
}
@Override // org.xmlpull.v1.XmlPullParser
public String getNamespacePrefix(int pos) throws XmlPullParserException {
int prefix = this.m_namespaces.getPrefix(pos);
return this.m_strings.getString(prefix);
}
@Override // org.xmlpull.v1.XmlPullParser
public String getNamespaceUri(int pos) throws XmlPullParserException {
int uri = this.m_namespaces.getUri(pos);
return this.m_strings.getString(uri);
}
@Override // android.util.AttributeSet
public String getClassAttribute() {
if (this.m_classAttribute == -1) {
return null;
}
int offset = getAttributeOffset(this.m_classAttribute);
int value = this.m_attributes[offset + 2];
return this.m_strings.getString(value);
}
@Override // android.util.AttributeSet
public String getIdAttribute() {
if (this.m_idAttribute == -1) {
return null;
}
int offset = getAttributeOffset(this.m_idAttribute);
int value = this.m_attributes[offset + 2];
return this.m_strings.getString(value);
}
@Override // android.util.AttributeSet
public int getIdAttributeResourceValue(int defaultValue) {
if (this.m_idAttribute == -1) {
return defaultValue;
}
int offset = getAttributeOffset(this.m_idAttribute);
int valueType = this.m_attributes[offset + 3];
if (valueType != 1) {
return defaultValue;
}
return this.m_attributes[offset + 4];
}
@Override // android.util.AttributeSet
public int getStyleAttribute() {
if (this.m_styleAttribute == -1) {
return 0;
}
int offset = getAttributeOffset(this.m_styleAttribute);
return this.m_attributes[offset + 4];
}
@Override // org.xmlpull.v1.XmlPullParser, android.util.AttributeSet
public int getAttributeCount() {
if (this.m_event != 2) {
return -1;
}
return this.m_attributes.length / 5;
}
@Override // org.xmlpull.v1.XmlPullParser
public String getAttributeNamespace(int index) {
int offset = getAttributeOffset(index);
int namespace = this.
纯java读取Apk信息,贡献全源码,可读取程序.apk中的AndroidManifest.xml所有信息
需积分: 9 145 浏览量
2022-11-17
14:31:45
上传
评论
收藏 17KB RAR 举报
_望
- 粉丝: 4
- 资源: 17
最新资源
- 基于MIC+NE555光敏电阻的声光控电路Multisim仿真原理图
- python tkinter-08-盒子模型.ev4.rar
- Doozy UI Manager 2023
- 基于matlab实现夜间车牌识别程序(1).rar
- 基于matlab实现无线传感器网络无需测距定位算法matlab源代码 包括apit,dv-hop,amorphous在内的共7个
- 基于python的yolov5实现的旋转目标检测
- 基于matlab实现无线传感器网络 CAB定位仿真程序 这是无线传感器节点定位CAB算法的仿真程序,由matlab完成.rar
- 基于matlab实现图像处理,本程序使用背景差分法对来往车辆进行检测和跟踪.rar
- 基于matlab实现视频监控中车型识别代码,自己写的,希望和大家多多交流.rar
- springcodespringcodespringcodespringcode
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈