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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? parameterparser.java

?? 解觖java技術中后臺無法上傳數給的情況
?? JAVA
字號:
/*
 * Copyright 2001-2004 The Apache Software Foundation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package net.myvietnam.mvncore.web.fileupload;

import java.util.HashMap;
import java.util.Map;

/**
 * A simple parser intended to parse sequences of name/value pairs.
 * Parameter values are exptected to be enclosed in quotes if they
 * contain unsafe characters, such as '=' characters or separators.
 * Parameter values are optional and can be omitted.
 *
 * <p>
 *  <code>param1 = value; param2 = "anything goes; really"; param3</code>
 * </p>
 *
 * @author <a href="mailto:oleg@ural.ru">Oleg Kalnichevski</a>
 *
 * @version $Id: ParameterParser.java,v 1.2 2006/02/12 04:43:11 minhnn Exp $
 */

public class ParameterParser {
    /**
     * String to be parsed.
     */
    private char[] chars = null;

    /**
     * Current position in the string.
     */
    private int pos = 0;

    /**
     * Maximum position in the string.
     */
    private int len = 0;

    /**
     * Start of a token.
     */
    private int i1 = 0;

    /**
     * End of a token.
     */
    private int i2 = 0;

    /**
     * Whether names stored in the map should be converted to lower case.
     */
    private boolean lowerCaseNames = false;

    /**
     * Default ParameterParser constructor.
     */
    public ParameterParser() {
        super();
    }

    /**
     * Are there any characters left to parse?
     *
     * @return <tt>true</tt> if there are unparsed characters,
     *         <tt>false</tt> otherwise.
     */
    private boolean hasChar() {
        return this.pos < this.len;
    }

    /**
     * A helper method to process the parsed token. This method removes
     * leading and trailing blanks as well as enclosing quotation marks,
     * when necessary.
     *
     * @param quoted <tt>true</tt> if quotation marks are expected,
     *               <tt>false</tt> otherwise.
     * @return the token
     */
    private String getToken(boolean quoted) {
        // Trim leading white spaces
        while ((i1 < i2) && (Character.isWhitespace(chars[i1]))) {
            i1++;
        }
        // Trim trailing white spaces
        while ((i2 > i1) && (Character.isWhitespace(chars[i2 - 1]))) {
            i2--;
        }
        // Strip away quotation marks if necessary
        if (quoted) {
            if (((i2 - i1) >= 2)
                && (chars[i1] == '"')
                && (chars[i2 - 1] == '"')) {
                i1++;
                i2--;
            }
        }
        String result = null;
        if (i2 > i1) {
            result = new String(chars, i1, i2 - i1);
        }
        return result;
    }

    /**
     * Tests if the given character is present in the array of characters.
     *
     * @param ch the character to test for presense in the array of characters
     * @param charray the array of characters to test against
     *
     * @return <tt>true</tt> if the character is present in the array of
     *   characters, <tt>false</tt> otherwise.
     */
    private boolean isOneOf(char ch, final char[] charray) {
        boolean result = false;
        for (int i = 0; i < charray.length; i++) {
            if (ch == charray[i]) {
                result = true;
                break;
            }
        }
        return result;
    }

    /**
     * Parses out a token until any of the given terminators
     * is encountered.
     *
     * @param terminators the array of terminating characters. Any of these
     * characters when encountered signify the end of the token
     *
     * @return the token
     */
    private String parseToken(final char[] terminators) {
        char ch;
        i1 = pos;
        i2 = pos;
        while (hasChar()) {
            ch = chars[pos];
            if (isOneOf(ch, terminators)) {
                break;
            }
            i2++;
            pos++;
        }
        return getToken(false);
    }

    /**
     * Parses out a token until any of the given terminators
     * is encountered outside the quotation marks.
     *
     * @param terminators the array of terminating characters. Any of these
     * characters when encountered outside the quotation marks signify the end
     * of the token
     *
     * @return the token
     */
    private String parseQuotedToken(final char[] terminators) {
        char ch;
        i1 = pos;
        i2 = pos;
        boolean quoted = false;
        boolean charEscaped = false;
        while (hasChar()) {
            ch = chars[pos];
            if (!quoted && isOneOf(ch, terminators)) {
                break;
            }
            if (!charEscaped && ch == '"') {
                quoted = !quoted;
            }
            charEscaped = (!charEscaped && ch == '\\');
            i2++;
            pos++;

        }
        return getToken(true);
    }

    /**
     * Returns <tt>true</tt> if parameter names are to be converted to lower
     * case when name/value pairs are parsed.
     *
     * @return <tt>true</tt> if parameter names are to be
     * converted to lower case when name/value pairs are parsed.
     * Otherwise returns <tt>false</tt>
     */
    public boolean isLowerCaseNames() {
        return this.lowerCaseNames;
    }

    /**
     * Sets the flag if parameter names are to be converted to lower case when
     * name/value pairs are parsed.
     *
     * @param b <tt>true</tt> if parameter names are to be
     * converted to lower case when name/value pairs are parsed.
     * <tt>false</tt> otherwise.
     */
    public void setLowerCaseNames(boolean b) {
        this.lowerCaseNames = b;
    }

    /**
     * Extracts a map of name/value pairs from the given string. Names are
     * expected to be unique.
     *
     * @param str the string that contains a sequence of name/value pairs
     * @param separator the name/value pairs separator
     *
     * @return a map of name/value pairs
     */
    public Map parse(final String str, char separator) {
        if (str == null) {
            return new HashMap();
        }
        return parse(str.toCharArray(), separator);
    }

    /**
     * Extracts a map of name/value pairs from the given array of
     * characters. Names are expected to be unique.
     *
     * @param chars the array of characters that contains a sequence of
     * name/value pairs
     * @param separator the name/value pairs separator
     *
     * @return a map of name/value pairs
     */
    public Map parse(final char[] chars, char separator) {
        if (chars == null) {
            return new HashMap();
        }
        return parse(chars, 0, chars.length, separator);
    }

    /**
     * Extracts a map of name/value pairs from the given array of
     * characters. Names are expected to be unique.
     *
     * @param chars the array of characters that contains a sequence of
     * name/value pairs
     * @param offset - the initial offset.
     * @param length - the length.
     * @param separator the name/value pairs separator
     *
     * @return a map of name/value pairs
     */
    public Map parse(
        final char[] chars,
        int offset,
        int length,
        char separator) {

        if (chars == null) {
            return new HashMap();
        }
        HashMap params = new HashMap();
        this.chars = chars;
        this.pos = offset;
        this.len = length;

        String paramName = null;
        String paramValue = null;
        while (hasChar()) {
            paramName = parseToken(new char[] {
                    '=', separator });
            paramValue = null;
            if (hasChar() && (chars[pos] == '=')) {
                pos++; // skip '='
                paramValue = parseQuotedToken(new char[] {
                        separator });
            }
            if (hasChar() && (chars[pos] == separator)) {
                pos++; // skip separator
            }
            if ((paramName != null) && (paramName.length() > 0)) {
                if (this.lowerCaseNames) {
                    paramName = paramName.toLowerCase();
                }
                params.put(paramName, paramValue);
            }
        }
        return params;
    }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
香蕉乱码成人久久天堂爱免费| 麻豆成人久久精品二区三区红| 国产欧美一区二区精品性| 日韩一区二区电影网| 91精品国产综合久久国产大片| 欧美日韩亚洲综合一区二区三区| 欧美最新大片在线看| 欧美三级乱人伦电影| 在线电影一区二区三区| 日韩你懂的在线播放| 精品国产伦一区二区三区观看体验 | 日韩黄色免费电影| 日韩电影免费一区| 人妖欧美一区二区| 美女高潮久久久| 国产精品影音先锋| 成人av资源在线观看| 91丨porny丨蝌蚪视频| 91国产精品成人| 91精品国产综合久久久久| 欧美va亚洲va国产综合| 国产精品视频一二| 亚洲一区二三区| 青青草精品视频| 粉嫩av一区二区三区| 91麻豆福利精品推荐| 欧美日韩在线直播| 日韩欧美一区二区三区在线| 国产亚洲1区2区3区| 亚洲老妇xxxxxx| 美国三级日本三级久久99| 国产精品伊人色| 欧美综合欧美视频| 精品久久久久一区| 亚洲欧美国产三级| 日本欧美久久久久免费播放网| 国产一区三区三区| 色婷婷综合久色| 精品国产三级a在线观看| 亚洲色欲色欲www| 免费在线观看视频一区| 丁香亚洲综合激情啪啪综合| 91福利国产精品| 久久久美女毛片| 亚洲国产成人tv| 国产91丝袜在线18| 欧美剧情片在线观看| 国产精品水嫩水嫩| 日韩avvvv在线播放| 粉嫩久久99精品久久久久久夜| 在线观看日韩国产| 欧美激情一区二区三区在线| 亚洲成人福利片| 9色porny自拍视频一区二区| 制服.丝袜.亚洲.另类.中文| 综合欧美亚洲日本| 韩国成人在线视频| 欧美亚洲一区二区在线| 国产亚洲成年网址在线观看| 午夜久久久久久| 欧美韩国日本不卡| 欧美精选在线播放| 国产精品国产三级国产有无不卡| 琪琪久久久久日韩精品| 一本大道久久a久久精品综合| 精品国产青草久久久久福利| 亚洲丶国产丶欧美一区二区三区| 大美女一区二区三区| 精品久久国产字幕高潮| 亚洲成av人片一区二区梦乃| 99re成人在线| 日本一区二区三区四区在线视频| 免费黄网站欧美| 欧美精品99久久久**| 亚洲免费大片在线观看| 成人h版在线观看| 久久久久久久精| 国产在线播放一区| 精品理论电影在线观看 | 色婷婷av一区二区三区之一色屋| 久久九九影视网| 黄色日韩三级电影| 日韩久久久久久| 日本中文字幕一区二区视频| 在线免费一区三区| 亚洲乱码一区二区三区在线观看| 成人妖精视频yjsp地址| 久久夜色精品国产噜噜av| 麻豆久久久久久久| 日韩一区二区三区视频在线| 午夜免费欧美电影| 欧美乱妇20p| 亚洲成人免费观看| 欧美人妇做爰xxxⅹ性高电影| 尤物在线观看一区| 色噜噜狠狠色综合中国| 亚洲乱码国产乱码精品精可以看| 99这里都是精品| 日韩美女视频一区| 在线观看精品一区| 一区二区三区电影在线播| 91成人免费在线视频| 怡红院av一区二区三区| 91国偷自产一区二区三区成为亚洲经典 | 国内精品伊人久久久久av影院| 欧美一级日韩一级| 精品一区二区三区视频 | 亚洲.国产.中文慕字在线| 在线观看国产一区二区| 亚洲成av人影院在线观看网| 欧美性欧美巨大黑白大战| 亚洲gay无套男同| 欧美一区二区三区系列电影| 在线欧美日韩精品| 亚洲一本大道在线| 91精品国产色综合久久ai换脸| 理论电影国产精品| 久久嫩草精品久久久久| 成人av电影免费观看| 亚洲天堂2014| 欧美久久久一区| 久久精品国产精品亚洲红杏| 久久久国产午夜精品| 97精品久久久久中文字幕| 一区二区三区高清| 欧美日韩精品免费| 韩国av一区二区三区四区| 久久久亚洲午夜电影| 午夜精品一区在线观看| 国产91色综合久久免费分享| 免费人成黄页网站在线一区二区| 成人免费视频网站在线观看| 伊人色综合久久天天| 在线91免费看| 国产一区二区导航在线播放| 中文字幕av免费专区久久| 日本高清视频一区二区| 免费xxxx性欧美18vr| 国产拍揄自揄精品视频麻豆| 色哟哟欧美精品| 日韩av成人高清| 国产精品久久久久永久免费观看| 99国产精品99久久久久久| 婷婷成人综合网| 国产欧美日本一区二区三区| 92精品国产成人观看免费| 免费的成人av| 亚洲欧洲成人自拍| 日韩一卡二卡三卡四卡| 成人精品在线视频观看| 日韩av一区二区三区四区| 日本一区二区成人| 欧美精品自拍偷拍| 国产成人精品免费视频网站| 亚洲电影激情视频网站| 中文字幕欧美激情| 88在线观看91蜜桃国自产| www.亚洲色图| 久久av资源网| 一区二区三区日韩欧美| 久久免费视频色| 欧美久久久久久蜜桃| 99久久国产综合精品色伊| 久久激五月天综合精品| 一区二区三区在线免费视频| 国产清纯在线一区二区www| 欧美日韩不卡一区| 色呦呦国产精品| 国产精品一区二区视频| 日产欧产美韩系列久久99| 亚洲精品久久7777| 国产欧美日韩在线看| 日韩限制级电影在线观看| 91福利在线播放| 99精品视频在线观看免费| 国产一区在线看| 毛片一区二区三区| 一区二区在线电影| 国产精品毛片a∨一区二区三区| 欧美一级专区免费大片| 99这里只有精品| 国产伦精品一区二区三区在线观看 | 亚洲精品高清视频在线观看| 久久久精品一品道一区| 日韩欧美一区二区视频| 欧美欧美午夜aⅴ在线观看| 一本色道久久综合亚洲91| 成人免费视频视频| 国产91精品一区二区麻豆亚洲| 久久99久久精品| 日本成人在线看| 日本伊人精品一区二区三区观看方式| 亚洲精品中文字幕乱码三区| 国产精品久久久久久久久免费樱桃 | 国产精品1区2区3区在线观看| 全国精品久久少妇| 日韩**一区毛片| 美洲天堂一区二卡三卡四卡视频| 午夜影视日本亚洲欧洲精品| 亚洲午夜久久久久久久久电影院|