/* -*- c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/
/*
* Copyright (c) 2003 Extreme! Lab, Indiana University. All rights reserved.
*
* This software is open source. See the bottom of this file for the license.
*
* $Id: MXParser.java,v 1.52 2006/11/09 18:29:37 aslom Exp $
*/
package org.xmlpull.mxp1;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.UnsupportedEncodingException;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
//TODO best handling of interning issues
// have isAllNewStringInterned ???
//TODO handling surrogate pairs: http://www.unicode.org/unicode/faq/utf_bom.html#6
//TODO review code for use of bufAbsoluteStart when keeping pos between next()/fillBuf()
/**
* Absolutely minimal implementation of XMLPULL V1 API
*
* @author <a href="http://www.extreme.indiana.edu/~aslom/">Aleksander Slominski</a>
*/
public class MXParser
implements XmlPullParser
{
//NOTE: no interning of those strings --> by Java lang spec they MUST be already interned
protected final static String XML_URI = "http://www.w3.org/XML/1998/namespace";
protected final static String XMLNS_URI = "http://www.w3.org/2000/xmlns/";
protected final static String FEATURE_XML_ROUNDTRIP=
//"http://xmlpull.org/v1/doc/features.html#xml-roundtrip";
"http://xmlpull.org/v1/doc/features.html#xml-roundtrip";
protected final static String FEATURE_NAMES_INTERNED =
"http://xmlpull.org/v1/doc/features.html#names-interned";
protected final static String PROPERTY_XMLDECL_VERSION =
"http://xmlpull.org/v1/doc/properties.html#xmldecl-version";
protected final static String PROPERTY_XMLDECL_STANDALONE =
"http://xmlpull.org/v1/doc/properties.html#xmldecl-standalone";
protected final static String PROPERTY_XMLDECL_CONTENT =
"http://xmlpull.org/v1/doc/properties.html#xmldecl-content";
protected final static String PROPERTY_LOCATION =
"http://xmlpull.org/v1/doc/properties.html#location";
/**
* Implementation notice:
* the is instance variable that controls if newString() is interning.
* <p><b>NOTE:</b> newStringIntern <b>always</b> returns interned strings
* and newString MAY return interned String depending on this variable.
* <p><b>NOTE:</b> by default in this minimal implementation it is false!
*/
protected boolean allStringsInterned;
protected void resetStringCache() {
//System.out.println("resetStringCache() minimum called");
}
protected String newString(char[] cbuf, int off, int len) {
return new String(cbuf, off, len);
}
protected String newStringIntern(char[] cbuf, int off, int len) {
return (new String(cbuf, off, len)).intern();
}
private static final boolean TRACE_SIZING = false;
// NOTE: features are not resettable and typically defaults to false ...
protected boolean processNamespaces;
protected boolean roundtripSupported;
// global parser state
protected String location;
protected int lineNumber;
protected int columnNumber;
protected boolean seenRoot;
protected boolean reachedEnd;
protected int eventType;
protected boolean emptyElementTag;
// element stack
protected int depth;
protected char[] elRawName[];
protected int elRawNameEnd[];
protected int elRawNameLine[];
protected String elName[];
protected String elPrefix[];
protected String elUri[];
//protected String elValue[];
protected int elNamespaceCount[];
/**
* Make sure that we have enough space to keep element stack if passed size.
* It will always create one additional slot then current depth
*/
protected void ensureElementsCapacity() {
final int elStackSize = elName != null ? elName.length : 0;
if( (depth + 1) >= elStackSize) {
// we add at least one extra slot ...
final int newSize = (depth >= 7 ? 2 * depth : 8) + 2; // = lucky 7 + 1 //25
if(TRACE_SIZING) {
System.err.println("TRACE_SIZING elStackSize "+elStackSize+" ==> "+newSize);
}
final boolean needsCopying = elStackSize > 0;
String[] arr = null;
// reuse arr local variable slot
arr = new String[newSize];
if(needsCopying) System.arraycopy(elName, 0, arr, 0, elStackSize);
elName = arr;
arr = new String[newSize];
if(needsCopying) System.arraycopy(elPrefix, 0, arr, 0, elStackSize);
elPrefix = arr;
arr = new String[newSize];
if(needsCopying) System.arraycopy(elUri, 0, arr, 0, elStackSize);
elUri = arr;
int[] iarr = new int[newSize];
if(needsCopying) {
System.arraycopy(elNamespaceCount, 0, iarr, 0, elStackSize);
} else {
// special initialization
iarr[0] = 0;
}
elNamespaceCount = iarr;
//TODO: avoid using element raw name ...
iarr = new int[newSize];
if(needsCopying) {
System.arraycopy(elRawNameEnd, 0, iarr, 0, elStackSize);
}
elRawNameEnd = iarr;
iarr = new int[newSize];
if(needsCopying) {
System.arraycopy(elRawNameLine, 0, iarr, 0, elStackSize);
}
elRawNameLine = iarr;
final char[][] carr = new char[newSize][];
if(needsCopying) {
System.arraycopy(elRawName, 0, carr, 0, elStackSize);
}
elRawName = carr;
// arr = new String[newSize];
// if(needsCopying) System.arraycopy(elLocalName, 0, arr, 0, elStackSize);
// elLocalName = arr;
// arr = new String[newSize];
// if(needsCopying) System.arraycopy(elDefaultNs, 0, arr, 0, elStackSize);
// elDefaultNs = arr;
// int[] iarr = new int[newSize];
// if(needsCopying) System.arraycopy(elNsStackPos, 0, iarr, 0, elStackSize);
// for (int i = elStackSize; i < iarr.length; i++)
// {
// iarr[i] = (i > 0) ? -1 : 0;
// }
// elNsStackPos = iarr;
//assert depth < elName.length;
}
}
// attribute stack
protected int attributeCount;
protected String attributeName[];
protected int attributeNameHash[];
//protected int attributeNameStart[];
//protected int attributeNameEnd[];
protected String attributePrefix[];
protected String attributeUri[];
protected String attributeValue[];
//protected int attributeValueStart[];
//protected int attributeValueEnd[];
/**
* Make sure that in attributes temporary array is enough space.
*/
protected void ensureAttributesCapacity(int size) {
final int attrPosSize = attributeName != null ? attributeName.length : 0;
if(size >= attrPosSize) {
final int newSize = size > 7 ? 2 * size : 8; // = lucky 7 + 1 //25
if(TRACE_SIZING) {
System.err.println("TRACE_SIZING attrPosSize "+attrPosSize+" ==> "+newSize);
}
final boolean needsCopying = attrPosSize > 0;
String[] arr = null;
arr = new String[newSize];
if(needsCopying) System.arraycopy(attributeName, 0, arr, 0, attrPosSize);
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
android openfire xmpp smack即时通讯,包括:聊天发生文字,表情,图片,语音。添加删除好友,消息提醒,群聊,邀请好友进入房间,聊天记录保存等等。界面美观。最后说明:此demo是在网上一个叫EIM企信通的demo基础上进行完善修改得来的成果,添加了好多功能,大家有兴趣的配置好openfire设置好IP就可以使用,完美运行,欢迎大家下载,不理解的留言问我,本人QQ:375642003
资源推荐
资源详情
资源评论
收起资源包目录
android openfire xmpp smack即时通讯,包括:聊天发生文字,表情,图片,语音等 (3378个子文件)
all-wcprops 8KB
all-wcprops 8KB
resources.ap_ 1.49MB
EIM.apk 2.04MB
jarlist.cache 120B
MXParser.class 46KB
MultiUserChat.class 44KB
MultiUserChat.class 33KB
AgentSession.class 29KB
RoomChatActivity.class 28KB
ContacterMainActivity.class 26KB
AgentSession.class 23KB
ChatActivity.class 22KB
BOSHClient.class 22KB
XmppConnectionManager.class 21KB
XMPPConnection.class 20KB
AbstractHashedMap.class 18KB
Base64.class 18KB
XMPPConnection.class 18KB
Workgroup.class 17KB
PacketParserUtils.class 17KB
Socks5BytestreamManager.class 17KB
Roster.class 16KB
Roster.class 16KB
VCard.class 15KB
AdHocCommandManager.class 14KB
AbstractHashedMap.class 14KB
BOSHConnection.class 14KB
Base64.class 13KB
Node.class 13KB
Workgroup.class 13KB
Socks5BytestreamManager.class 13KB
FileTransferNegotiator.class 13KB
R$drawable.class 12KB
AdHocCommandManager.class 12KB
ConfigureForm.class 12KB
Connection.class 12KB
SQLiteTemplate.class 12KB
ServiceDiscoveryManager.class 12KB
VCard.class 12KB
PacketReader.class 12KB
ActivitySupport.class 11KB
DNSSEC.class 11KB
MUCRoom.class 11KB
Node.class 11KB
Name.class 11KB
SASLAuthentication.class 11KB
R$id.class 11KB
AbstractReferenceMap.class 11KB
PacketReader.class 10KB
EnhancedDebugger.class 10KB
PubSubManager.class 10KB
Connection.class 10KB
Record.class 10KB
Cache.class 10KB
InBandBytestreamManager.class 10KB
FileTransferNegotiator.class 10KB
CommonUtils.class 10KB
Lookup.class 10KB
TimestampTool.class 10KB
Message.class 9KB
EnhancedDebuggerWindow.class 9KB
ConfigureForm.class 9KB
ConnectionConfiguration.class 9KB
DigestMD5SaslClient.class 9KB
PrivacyListManager.class 9KB
FriendInfoActivity.class 9KB
Message.class 9KB
ServiceDiscoveryManager.class 9KB
ZoneTransferIn.class 9KB
SASLAuthentication.class 9KB
InBandBytestreamManager.class 9KB
OutgoingFileTransfer.class 9KB
Packet.class 9KB
RoomChatAdapter.class 9KB
ChatActivity$MessageListAdapter.class 9KB
PubSubManager.class 9KB
Zone.class 8KB
ValidateUtil.class 8KB
LiteDebugger.class 8KB
AbstractReferenceMap.class 8KB
Form.class 8KB
ChartRecordListView.class 8KB
Tokenizer.class 8KB
MainActivity.class 8KB
ConnectionConfiguration.class 8KB
MultipleRecipientManager.class 8KB
MyNoticeActivity.class 8KB
NoticeManager.class 8KB
ContacterManager.class 8KB
HttpURLTools.class 8KB
Subject.class 8KB
ResolverConfig.class 8KB
RoomMemberActivity.class 8KB
ChatManager.class 8KB
Socks5BytestreamRequest.class 8KB
LoginContext.class 8KB
AgentRoster.class 8KB
Gateway.class 8KB
StringUtils.class 7KB
共 3378 条
- 1
- 2
- 3
- 4
- 5
- 6
- 34
yy991852
- 粉丝: 3
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
- 5
- 6
前往页