亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? wbxmldecoder.java~3~

?? jwap 協(xié)議 udp 可以用于手機(jī)通訊
?? JAVA~3~
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
/**
 * JWAP - A Java Implementation of the WAP Protocols
 * Copyright (C) 2001-2004 Niko Bender
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */

package net.sourceforge.jwap.util.wbxml;

import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;

import net.sourceforge.jwap.util.TransTable;

import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.DocumentType;
import org.w3c.dom.Element;
import org.w3c.dom.Text;

/**
 * to do's :- string table length is in multiple byte format, currently it is assumed to be single byte
 * index in string table should also be read as multiple byte format
 * character encoding supported is only utf-8,
 * for other encodings the termination character in string table can be different...
 *
 *
 * @author <a href="mailto:suvarna@witscale.com">Suvarna Kadam</a>
 */

public class WBXMLDecoder {
	private static WBXMLDecoder instance;
	private DataInputStream wbxmlStream;
	private Document xmlDocument;
	private String publicId = "UNKNOWN";
	private byte publicIdIndex = -1;
	private String encoding;
	private StringBuffer stringTable;

	private byte parentBitMask = (byte) 0x40;
	// The bit representation 10000000
	private byte attributeBitMask = (byte) 0x80;
	// The bit representation 01000000
	private TokenRepository tokenRepository;
	public static WBXMLDecoder getInstance() {
		if (instance == null)
			instance = new WBXMLDecoder();
		return instance;
	}

	private WBXMLDecoder() {
		initialize();
	}

	private void initialize() {

	}

	public Document decode(InputStream wbxmlStream) {
		this.wbxmlStream = new DataInputStream(wbxmlStream);
		try {
			xmlDocument =
				DocumentBuilderFactory
					.newInstance()
					.newDocumentBuilder()
					.newDocument();
			decodeProlog();
			decodeBody();
		} catch (Exception exp) {
			//exp.printStackTrace();
		}
		return xmlDocument;

	}


        public Document decodeFowChk(InputStream wbxmlStream) {
                this.wbxmlStream = new DataInputStream(wbxmlStream);
                try {
                        xmlDocument =
                                DocumentBuilderFactory
                                        .newInstance()
                                        .newDocumentBuilder()
                                        .newDocument();

                                    try {
       byte version = this.wbxmlStream.readByte();


     readPublicID();
     byte charset =  this.wbxmlStream.readByte(); // to do for mutiple byte
     encoding =  TransTable.getTable("charsets").code2str(charset);
     byte strtblSize =  this.wbxmlStream.readByte();
     // TODO for multi-byte and negative size
     stringTable = new StringBuffer(strtblSize);
     for (int i = 0; i < strtblSize; i++)
             stringTable.append((char)  this.wbxmlStream.readByte());
     if (publicIdIndex != -1)
             readPublicIDFromStringTable();
     // Now initialze the token repository as per the public identifier specified
     String publicIDInHex =
             PublicIdentifiers.getInstance().getPublicIdentifierValueHex(
                     publicId);
     tokenRepository = TokenRepository.getInstance(publicIDInHex);
     }
     catch (IOException ex) {
     }

                        decodeBody();
                } catch (Exception exp) {
                        //exp.printStackTrace();
                }
                return xmlDocument;

        }


	/**
	 *  currently encoding cannot be specifies as DOM does not have any API to access the XML declaration.
	 * by default utf-16 is used.. If encoding is to be used ...
	 * xmlDocument.getImplementation().String piData = "version=\"1.0\" encoding=\"" + encoding + "\"";
	 * ProcessingInstruction xmlDeclaration = xmlDocument.createProcessingInstruction("xml", piData);
	 * xmlDocument.insertBefore(xmlDeclaration, xmlDocument.getDocumentElement());
	 **/

	private void decodeProlog(){
                try {
                  byte version = wbxmlStream.readByte();


		readPublicID();
		byte charset = wbxmlStream.readByte(); // to do for mutiple byte
		encoding =  TransTable.getTable("charsets").code2str(charset);
		byte strtblSize = wbxmlStream.readByte();
		// TODO for multi-byte and negative size
		stringTable = new StringBuffer(strtblSize);
		for (int i = 0; i < strtblSize; i++)
			stringTable.append((char) wbxmlStream.readByte());
		if (publicIdIndex != -1)
			readPublicIDFromStringTable();
		// Now initialze the token repository as per the public identifier specified
		String publicIDInHex =
			PublicIdentifiers.getInstance().getPublicIdentifierValueHex(
				publicId);
		tokenRepository = TokenRepository.getInstance(publicIDInHex);
                }
                catch (IOException ex) {
                }
	}

	private void readPublicIDFromStringTable() {
		char c = 0x0;
		int endIndex =
			stringTable.toString().indexOf(new String(new char[] { c }), publicIdIndex);
		if (endIndex == -1)
			publicId = stringTable.substring(publicIdIndex);
		else
			publicId = stringTable.substring(publicIdIndex, endIndex);

	}

	private void readPublicID(){
		byte[] multipleBytes = new byte[4];
                byte nextByte = (byte) 0;
                try {
                  nextByte = wbxmlStream.readByte();

                  if (nextByte == 0) {
                    // public id is encoded as string in form:-  0 indexInstringtable
                    publicIdIndex = wbxmlStream.readByte();

                  }
                  else { // public id is encoded in multi-byte integer format(mb_u_int32)
                    int i = 0;
                    StringBuffer strBuf = new StringBuffer();
                    while ( (nextByte & 0x80) == 0x80) { //msb IS 1
                      String str = Integer.toBinaryString(nextByte & 0x7F);
                      if (str.length() < 7) {
                        int zerosToPumpIn = 7 - str.length();
                        for (int j = 0; j < zerosToPumpIn; j++)
                          strBuf.append('0');

                      }
                      strBuf.append(str);
                      nextByte = wbxmlStream.readByte();
                    }
                    String str = Integer.toBinaryString(nextByte & 0x7F);
                    if (str.length() < 7) {
                      int zerosToPumpIn = 7 - str.length();
                      for (int j = 0; j < zerosToPumpIn; j++)
                        strBuf.append('0');

                    }
                    strBuf.append(str);
                    int publicIdValue =
                        Integer.valueOf(strBuf.toString(), 2).intValue();
                    publicId =
                        PublicIdentifiers.getInstance().getPublicIdentifier(
                            publicIdValue);
                  }
                }

             catch (IOException ex) {
             }

	}

	private void decodeBody(){
		writeRootElement();
	}

	private void writeRootElement(){
                byte maskedTokenValue = (byte) 0;
                try {
                  maskedTokenValue = wbxmlStream.readByte();
                }
                catch (IOException ex) {
                }
		byte actualTokenValue = getTokenValue(maskedTokenValue);
		String rootElementName = tokenRepository.getTagName(actualTokenValue);
		try {
			DocumentBuilder builder =
				DocumentBuilderFactory.newInstance().newDocumentBuilder();
			String systemId =
				PublicIdentifiers.getInstance().getSystemIdentifier(publicId);
			DocumentType docType =
				builder.getDOMImplementation().createDocumentType(
					rootElementName,
					publicId,
					systemId);
			xmlDocument =
				builder.getDOMImplementation().createDocument(
					"",
					rootElementName,
					docType);
			if (hasAttributes(maskedTokenValue))
				setAttributes(xmlDocument.getDocumentElement());
			if (hasContent(maskedTokenValue))
				writeChildElement(xmlDocument.getDocumentElement());

		} catch (Exception exp) {
			//exp.printStackTrace();
		}

	}

	private void writeChildElement(Element parent) throws IOException {
		byte maskedTokenValue = wbxmlStream.readByte();

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久国产精品99久久久久久老狼 | 在线播放中文一区| 国产一区久久久| 亚洲欧美电影院| 国产亚洲视频系列| 7878成人国产在线观看| caoporen国产精品视频| 狠狠久久亚洲欧美| 日本欧美加勒比视频| 国产精品天干天干在观线| 日韩欧美国产小视频| 欧美亚一区二区| 色综合久久88色综合天天6| 国产一区二区三区久久悠悠色av| 丝袜美腿亚洲一区| 亚洲一区影音先锋| 一区二区三区资源| 亚洲人成在线播放网站岛国| 欧美国产一区二区| 中文字幕免费观看一区| 久久久电影一区二区三区| 日韩欧美国产不卡| 欧美va日韩va| 亚洲精品一区二区三区影院 | 免费美女久久99| 日韩精品色哟哟| 日本欧美大码aⅴ在线播放| 久久久久国产精品麻豆| 日本电影欧美片| 91网站最新地址| 欧美日韩在线电影| 欧美肥大bbwbbw高潮| 精品国产青草久久久久福利| 欧美成人猛片aaaaaaa| 国产精品二区一区二区aⅴ污介绍| 日韩欧美在线一区二区三区| 久久嫩草精品久久久精品一| 中文字幕精品一区| 亚洲午夜在线电影| 午夜影视日本亚洲欧洲精品| 久久99精品久久只有精品| 豆国产96在线|亚洲| 欧美人体做爰大胆视频| 久久亚洲精品国产精品紫薇| 亚洲欧洲制服丝袜| 奇米精品一区二区三区在线观看| 国产精华液一区二区三区| yourporn久久国产精品| 欧美精品乱码久久久久久| 久久久国产综合精品女国产盗摄| 樱桃国产成人精品视频| 老汉av免费一区二区三区| 99精品国产视频| 久久这里只有精品6| 亚洲精品视频在线看| 国产在线播放一区三区四| 精品视频1区2区3区| 国产精品女人毛片| 国产一区二区三区免费观看| 欧美日韩国产综合一区二区| 亚洲天堂av一区| 国产乱码字幕精品高清av| 4438亚洲最大| 亚洲国产精品综合小说图片区| 一本色道久久综合狠狠躁的推荐| 7777精品久久久大香线蕉| 亚洲精品乱码久久久久| 成人黄色在线看| 久久久蜜桃精品| 国产在线看一区| 精品sm在线观看| 激情亚洲综合在线| 欧美大肚乱孕交hd孕妇| 蜜臀av国产精品久久久久| 3d动漫精品啪啪1区2区免费| 视频一区视频二区在线观看| 欧洲亚洲精品在线| 亚洲精品国产品国语在线app| 94-欧美-setu| 天堂久久久久va久久久久| 欧美电影在线免费观看| 免费观看久久久4p| 日本精品裸体写真集在线观看| 久久久久久久久免费| 国模套图日韩精品一区二区| 国产日韩欧美在线一区| 成人av先锋影音| 亚洲一区二区三区四区五区黄| 欧美日韩国产小视频| 极品尤物av久久免费看| 国产精品久久久久久久久久久免费看| 不卡视频免费播放| 亚洲欧美日韩系列| 日韩写真欧美这视频| 成人sese在线| 午夜精品免费在线观看| 国产亚洲福利社区一区| 91国产福利在线| 老司机精品视频线观看86 | 91精品婷婷国产综合久久竹菊| 蜜臀av性久久久久蜜臀aⅴ四虎| 国产亚洲综合在线| 欧美午夜精品一区| 成人激情图片网| 三级不卡在线观看| 亚洲欧美在线高清| 久久综合久久综合久久| 欧美日韩高清一区二区| 成人午夜激情在线| 精品一区二区三区在线播放视频| 亚洲精品日韩一| 国产婷婷精品av在线| 日韩三区在线观看| 欧美三级电影精品| 日本韩国精品在线| av中文字幕不卡| 成人午夜精品在线| 国产精品白丝av| 九九九精品视频| 精品亚洲国产成人av制服丝袜| 亚洲综合免费观看高清完整版 | 亚洲综合色婷婷| 亚洲视频一区二区在线观看| 国产精品美女久久久久久久久久久 | 久久五月婷婷丁香社区| 日韩三级免费观看| 欧美成人国产一区二区| 欧美区视频在线观看| 91精品国产入口| 精品sm在线观看| 26uuu国产在线精品一区二区| 欧美tickling网站挠脚心| 日韩你懂的在线播放| 欧亚洲嫩模精品一区三区| 成人18视频日本| 一本久道久久综合中文字幕| 99久久综合99久久综合网站| 91黄视频在线| 欧美日韩国产综合一区二区三区| 日韩片之四级片| 国产色一区二区| 亚洲激情男女视频| 日韩福利电影在线| 国产一区二区女| 色就色 综合激情| 精品久久久久一区| 亚洲色图欧洲色图婷婷| 日韩精品国产精品| 国产成人精品网址| 欧美一区二区在线播放| 国产人成亚洲第一网站在线播放 | 91精品久久久久久久99蜜桃| 久久九九全国免费| 午夜电影一区二区三区| 国产成人精品午夜视频免费| 欧美欧美欧美欧美首页| 国产视频一区不卡| 欧美aaaaaa午夜精品| 成人aa视频在线观看| 久久欧美中文字幕| 丝袜美腿高跟呻吟高潮一区| 在线观看三级视频欧美| 精品精品欲导航| 婷婷成人激情在线网| 一本久久a久久精品亚洲| 国产女主播在线一区二区| 蜜桃一区二区三区四区| 欧美美女一区二区在线观看| 国产精品国产三级国产专播品爱网 | 欧美经典一区二区| 麻豆91免费观看| 日韩午夜激情av| 理论电影国产精品| 91精品国产一区二区人妖| 亚洲国产精品久久不卡毛片| 色综合色狠狠天天综合色| 亚洲视频在线一区二区| 不卡视频免费播放| 亚洲色图20p| 色偷偷88欧美精品久久久| 亚洲精品美国一| 欧美中文字幕不卡| 亚洲成人免费影院| 91精品久久久久久久91蜜桃| 久久精品国产在热久久| www国产亚洲精品久久麻豆| 国产成人日日夜夜| 亚洲欧美日韩电影| 欧美一区国产二区| 国产制服丝袜一区| 国产精品另类一区| 欧美日韩一区高清| 久久精品国产精品亚洲综合| 欧美国产视频在线| 欧美色网一区二区| 国产成人综合网| 亚洲1区2区3区视频| 2024国产精品| 在线观看91视频| 亚洲第一福利一区|