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

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

?? stringutils.java

?? Jive論壇2.5版本的源程序
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/**
 * $RCSfile: StringUtils.java,v $
 * $Revision: 1.1.1.1 $
 * $Date: 2002/09/09 13:51:15 $
 *
 * New Jive  from Jdon.com.
 *
 * This software is the proprietary information of CoolServlets, Inc.
 * Use is subject to license terms.
 */

package com.jivesoftware.util;

import java.security.*;
import java.text.*;
import java.util.*;
import org.apache.oro.text.perl.Perl5Util;

/**
 * Utility class to peform common String manipulation algorithms.
 */
public class StringUtils {

    // Constants used by escapeHTMLTags
    private static final char[] QUOTE_ENCODE = """.toCharArray();
    private static final char[] AMP_ENCODE = "&".toCharArray();
    private static final char[] LT_ENCODE = "<".toCharArray();
    private static final char[] GT_ENCODE = ">".toCharArray();

    /**
     * Replaces all instances of oldString with newString in line.
     *
     * @param line the String to search to perform replacements on
     * @param oldString the String that should be replaced by newString
     * @param newString the String that will replace all instances of oldString
     *
     * @return a String will all instances of oldString replaced by newString
     */
    public static final String replace( String line, String oldString, String newString )
    {
        if (line == null) {
            return null;
        }
        int i=0;
        if ( ( i=line.indexOf( oldString, i ) ) >= 0 ) {
            char [] line2 = line.toCharArray();
            char [] newString2 = newString.toCharArray();
            int oLength = oldString.length();
            StringBuffer buf = new StringBuffer(line2.length);
            buf.append(line2, 0, i).append(newString2);
            i += oLength;
            int j = i;
            while( ( i=line.indexOf( oldString, i ) ) > 0 ) {
                buf.append(line2, j, i-j).append(newString2);
                i += oLength;
                j = i;
            }
            buf.append(line2, j, line2.length - j);
            return buf.toString();
        }
        return line;
    }

    /**
     * Replaces all instances of oldString with newString in line with the
     * added feature that matches of newString in oldString ignore case.
     *
     * @param line the String to search to perform replacements on
     * @param oldString the String that should be replaced by newString
     * @param newString the String that will replace all instances of oldString
     *
     * @return a String will all instances of oldString replaced by newString
     */
    public static final String replaceIgnoreCase(String line, String oldString,
            String newString)
    {
        if (line == null) {
            return null;
        }
        String lcLine = line.toLowerCase();
        String lcOldString = oldString.toLowerCase();
        int i=0;
        if ((i=lcLine.indexOf(lcOldString, i)) >= 0) {
            char [] line2 = line.toCharArray();
            char [] newString2 = newString.toCharArray();
            int oLength = oldString.length();
            StringBuffer buf = new StringBuffer(line2.length);
            buf.append(line2, 0, i).append(newString2);
            i += oLength;
            int j = i;
            while ((i=lcLine.indexOf(lcOldString, i)) > 0) {
                buf.append(line2, j, i-j).append(newString2);
                i += oLength;
                j = i;
            }
            buf.append(line2, j, line2.length - j);
            return buf.toString();
        }
        return line;
    }

    /**
     * Replaces all instances of oldString with newString in line with the
     * added feature that matches of newString in oldString ignore case.
     * The count paramater is set to the number of replaces performed.
     *
     * @param line the String to search to perform replacements on
     * @param oldString the String that should be replaced by newString
     * @param newString the String that will replace all instances of oldString
     * @param count a value that will be updated with the number of replaces
     *      performed.
     *
     * @return a String will all instances of oldString replaced by newString
     */
    public static final String replaceIgnoreCase(String line, String oldString,
            String newString, int [] count)
    {
        if (line == null) {
            return null;
        }
        String lcLine = line.toLowerCase();
        String lcOldString = oldString.toLowerCase();
        int i=0;
        if ((i=lcLine.indexOf(lcOldString, i)) >= 0) {
            int counter = 0;
            char [] line2 = line.toCharArray();
            char [] newString2 = newString.toCharArray();
            int oLength = oldString.length();
            StringBuffer buf = new StringBuffer(line2.length);
            buf.append(line2, 0, i).append(newString2);
            i += oLength;
            int j = i;
            while ((i=lcLine.indexOf(lcOldString, i)) > 0) {
                counter++;
                buf.append(line2, j, i-j).append(newString2);
                i += oLength;
                j = i;
            }
            buf.append(line2, j, line2.length - j);
            count[0] = counter;
            return buf.toString();
        }
        return line;
    }

   /**
    * Replaces all instances of oldString with newString in line.
    * The count Integer is updated with number of replaces.
    *
    * @param line the String to search to perform replacements on
    * @param oldString the String that should be replaced by newString
    * @param newString the String that will replace all instances of oldString
    *
    * @return a String will all instances of oldString replaced by newString
    */
    public static final String replace(String line, String oldString,
            String newString, int[] count)
    {
        if (line == null) {
            return null;
        }
        int i=0;
        if ((i=line.indexOf(oldString, i)) >= 0) {
            int counter = 0;
            counter++;
            char [] line2 = line.toCharArray();
            char [] newString2 = newString.toCharArray();
            int oLength = oldString.length();
            StringBuffer buf = new StringBuffer(line2.length);
            buf.append(line2, 0, i).append(newString2);
            i += oLength;
            int j = i;
            while ((i=line.indexOf(oldString, i)) > 0) {
                counter++;
                buf.append(line2, j, i-j).append(newString2);
                i += oLength;
                j = i;
            }
            buf.append(line2, j, line2.length-j);
            count[0] = counter;
            return buf.toString();
        }
        return line;
    }

    /**
     * This method takes a string which may contain HTML tags (ie, <b>,
     * <table>, etc) and converts the '&lt'' and '>' characters to
     * their HTML escape sequences.
     *
     * @param in the text to be converted.
     * @return the input string with the characters '<' and '>' replaced
     *  with their HTML escape sequences.
     */
    public static final String escapeHTMLTags(String in) {
        if (in == null) {
            return null;
        }
        char ch;
        int i=0;
        int last=0;
        char[] input = in.toCharArray();
        int len = input.length;
        StringBuffer out = new StringBuffer((int)(len*1.3));
        for (; i < len; i++) {
            ch = input[i];
            if (ch > '>') {
                continue;
            } else if (ch == '<') {
                if (i > last) {
                    out.append(input, last, i - last);
                }
                last = i + 1;
                out.append(LT_ENCODE);
            } else if (ch == '>') {
                if (i > last) {
                    out.append(input, last, i - last);
                }
                last = i + 1;
                out.append(GT_ENCODE);
            }
        }
        if (last == 0) {
            return in;
        }
        if (i > last) {
            out.append(input, last, i - last);
        }
        return out.toString();
    }

    /**
     * Used by the hash method.
     */
    private static MessageDigest digest = null;

    /**
     * Hashes a String using the Md5 algorithm and returns the result as a
     * String of hexadecimal numbers. This method is synchronized to avoid
     * excessive MessageDigest object creation. If calling this method becomes
     * a bottleneck in your code, you may wish to maintain a pool of
     * MessageDigest objects instead of using this method.
     * <p>
     * A hash is a one-way function -- that is, given an
     * input, an output is easily computed. However, given the output, the
     * input is almost impossible to compute. This is useful for passwords
     * since we can store the hash and a hacker will then have a very hard time
     * determining the original password.
     * <p>
     * In Jive, every time a user logs in, we simply
     * take their plain text password, compute the hash, and compare the
     * generated hash to the stored hash. Since it is almost impossible that
     * two passwords will generate the same hash, we know if the user gave us
     * the correct password or not. The only negative to this system is that
     * password recovery is basically impossible. Therefore, a reset password
     * method is used instead.
     *
     * @param data the String to compute the hash of.
     * @return a hashed version of the passed-in String
     */
    public synchronized static final String hash(String data) {
        if (digest == null) {
            try {
                digest = MessageDigest.getInstance("MD5");
            }
            catch (NoSuchAlgorithmException nsae) {
                System.err.println("Failed to load the MD5 MessageDigest. " +
                "Jive will be unable to function normally.");
                nsae.printStackTrace();
            }
        }
        // Now, compute hash.
        digest.update(data.getBytes());
        return encodeHex(digest.digest());
    }

    /**
     * Turns an array of bytes into a String representing each byte as an
     * unsigned hex number.
     * <p>
     * Method by Santeri Paavolainen, Helsinki Finland 1996<br>
     * (c) Santeri Paavolainen, Helsinki Finland 1996<br>
     * Distributed under LGPL.
     *
     * @param bytes an array of bytes to convert to a hex-string
     * @return generated hex string
     */
    public static final String encodeHex(byte[] bytes) {
        StringBuffer buf = new StringBuffer(bytes.length * 2);
        int i;

        for (i = 0; i < bytes.length; i++) {
            if (((int) bytes[i] & 0xff) < 0x10) {
                buf.append("0");
            }
            buf.append(Long.toString((int) bytes[i] & 0xff, 16));
        }
        return buf.toString();
    }

    /**
     * Turns a hex encoded string into a byte array. It is specifically meant
     * to "reverse" the toHex(byte[]) method.
     *
     * @param hex a hex encoded String to transform into a byte array.
     * @return a byte array representing the hex String[
     */
    public static final byte[] decodeHex(String hex) {
        char [] chars = hex.toCharArray();
        byte[] bytes = new byte[chars.length/2];
        int byteCount = 0;
        for (int i=0; i<chars.length; i+=2) {
            byte newByte = 0x00;
            newByte |= hexCharToByte(chars[i]);
            newByte <<= 4;
            newByte |= hexCharToByte(chars[i+1]);
            bytes[byteCount] = newByte;
            byteCount++;
        }
        return bytes;
    }

    /**
     * Returns the the byte value of a hexadecmical char (0-f). It's assumed
     * that the hexidecimal chars are lower case as appropriate.
     *
     * @param ch a hexedicmal character (0-f)
     * @return the byte value of the character (0x00-0x0F)
     */
    private static final byte hexCharToByte(char ch) {
        switch(ch) {
            case '0': return 0x00;
            case '1': return 0x01;
            case '2': return 0x02;
            case '3': return 0x03;
            case '4': return 0x04;
            case '5': return 0x05;
            case '6': return 0x06;
            case '7': return 0x07;
            case '8': return 0x08;
            case '9': return 0x09;
            case 'a': return 0x0A;
            case 'b': return 0x0B;
            case 'c': return 0x0C;
            case 'd': return 0x0D;
            case 'e': return 0x0E;
            case 'f': return 0x0F;
        }
        return 0x00;
    }

    //*********************************************************************
    //* Base64 - a simple base64 encoder and decoder.
    //*
    //*     Copyright (c) 1999, Bob Withers - bwit@pobox.com
    //*
    //* This code may be freely used for any purpose, either personal
    //* or commercial, provided the authors copyright notice remains
    //* intact.
    //*********************************************************************

    /**
     * Encodes a String as a base64 String.
     *
     * @param data a String to encode.
     * @return a base64 encoded String.
     */
    public static String encodeBase64(String data) {
        return encodeBase64(data.getBytes());
    }

    /**
     * Encodes a byte array into a base64 String.
     *
     * @param data a byte array to encode.
     * @return a base64 encode String.
     */
    public static String encodeBase64(byte[] data) {
        int c;
        int len = data.length;
        StringBuffer ret = new StringBuffer(((len / 3) + 1) * 4);
        for (int i = 0; i < len; ++i) {
            c = (data[i] >> 2) & 0x3f;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产三级欧美三级日产三级99 | 精品视频一区二区不卡| 欧美韩日一区二区三区四区| 国产一区二区免费看| 国产视频视频一区| 成人激情校园春色| 亚洲午夜精品一区二区三区他趣| 欧美午夜片在线观看| 日韩中文字幕亚洲一区二区va在线| 欧美日韩高清一区二区| 久久精品理论片| 国产清纯白嫩初高生在线观看91| 97久久精品人人爽人人爽蜜臀| 亚洲卡通动漫在线| 欧美一区二区精美| 国产a精品视频| 一区二区免费视频| 日韩欧美视频一区| 成人网男人的天堂| 午夜精品久久久久久久久久 | 国产欧美日韩综合| 欧洲色大大久久| 韩国精品主播一区二区在线观看| 久久久精品中文字幕麻豆发布| 91丨九色丨国产丨porny| 亚洲成人www| 欧美激情一区不卡| 91麻豆精品国产自产在线观看一区| 韩国女主播成人在线| 亚洲免费高清视频在线| 欧美二区三区的天堂| 成人一区二区在线观看| 日韩精品电影一区亚洲| 国产精品色哟哟网站| 欧美日韩情趣电影| 国产成人在线网站| 五月婷婷综合激情| 亚洲欧洲成人自拍| 日韩免费在线观看| 日本韩国欧美三级| 国产成人av一区二区| 爽好多水快深点欧美视频| 中文字幕一区二区三区色视频| 69p69国产精品| 91视频观看免费| 国产成人夜色高潮福利影视| 婷婷综合在线观看| 亚洲激情成人在线| 国产精品每日更新在线播放网址| 8v天堂国产在线一区二区| 99久久伊人网影院| 国产成人久久精品77777最新版本 国产成人鲁色资源国产91色综 | www.爱久久.com| 九九九精品视频| 三级久久三级久久| 亚洲精品日韩一| 国产精品久久久久久久午夜片| 日韩美女一区二区三区四区| 欧美日韩久久一区| 在线精品观看国产| 91网站最新网址| 成人黄色网址在线观看| 国产99一区视频免费| 国产麻豆成人精品| 精品一区二区免费| 男女男精品视频网| 天堂久久一区二区三区| 五月综合激情日本mⅴ| 亚洲成人动漫一区| 亚洲国产视频在线| 亚洲高清视频的网址| 亚洲二区在线视频| 午夜国产精品一区| 日韩在线观看一区二区| 天涯成人国产亚洲精品一区av| 亚洲一区在线观看免费观看电影高清 | 成人av在线网| 成人午夜av影视| 99re8在线精品视频免费播放| 国产91在线观看| 国产成人精品www牛牛影视| 国产超碰在线一区| 成人福利视频在线看| 色综合 综合色| 91福利国产成人精品照片| 欧美专区日韩专区| 91精品啪在线观看国产60岁| 日韩午夜电影av| 精品对白一区国产伦| 久久网站热最新地址| 久久久精品综合| 日韩美女视频一区二区| 亚洲综合色成人| 日本aⅴ亚洲精品中文乱码| 久久国产精品免费| 国产成人综合精品三级| 色综合久久六月婷婷中文字幕| 在线观看免费亚洲| 91精品黄色片免费大全| www久久精品| 中文字幕在线观看一区| 亚洲一区国产视频| 精品一区二区三区香蕉蜜桃| 国产91高潮流白浆在线麻豆 | 狠狠v欧美v日韩v亚洲ⅴ| 国产高清无密码一区二区三区| av色综合久久天堂av综合| 欧美日韩在线免费视频| 精品国产乱码久久久久久久| 国产精品免费av| 日产精品久久久久久久性色| 国产一区二区三区国产| 在线亚洲人成电影网站色www| 91精品国产欧美日韩| 国产精品久久久久aaaa樱花| 午夜影院久久久| 国产iv一区二区三区| 欧美三级日韩三级| 国产日产精品一区| 日韩精品午夜视频| 99久久久久久| 精品福利一二区| 亚洲成人在线免费| 国产成人免费在线视频| 欧美日韩国产综合视频在线观看| 精品日本一线二线三线不卡| 国产精品国产精品国产专区不片| 最新国产成人在线观看| 久久99国内精品| 色婷婷激情久久| 日韩精品一区国产麻豆| 亚洲欧美在线视频观看| 一区二区三区四区在线播放| 日本va欧美va欧美va精品| 成人网页在线观看| 91 com成人网| 中文字幕佐山爱一区二区免费| 午夜精品成人在线| 99精品欧美一区| 欧美大黄免费观看| 亚洲女与黑人做爰| 国内成人精品2018免费看| 91成人在线精品| 国产嫩草影院久久久久| 日韩中文字幕麻豆| 久久www免费人成看片高清| 欧美高清dvd| 中文字幕不卡一区| 蜜芽一区二区三区| 99久久国产综合精品色伊| 国产精品日韩精品欧美在线| 日韩电影在线观看电影| www.日本不卡| 久久综合成人精品亚洲另类欧美| 亚洲精品免费在线观看| 国产高清不卡一区二区| 久久精品在这里| 蜜桃一区二区三区在线观看| 色综合天天天天做夜夜夜夜做| 久久影视一区二区| 国产精品自拍av| 欧美一区二区三级| 亚洲国产综合在线| 日本国产一区二区| 国产精品视频一二| 国产夫妻精品视频| 欧美成人一区二区三区片免费 | 日本美女视频一区二区| 欧美性受xxxx黑人xyx性爽| 一区精品在线播放| 图片区小说区区亚洲影院| 欧美肥妇bbw| 亚洲va欧美va天堂v国产综合| 99九九99九九九视频精品| 2014亚洲片线观看视频免费| 蜜桃久久久久久| 欧美综合一区二区| 亚洲午夜久久久| 在线国产亚洲欧美| 中文字幕一区二区三区在线观看| 久久99国产精品麻豆| 精品日本一线二线三线不卡| 亚洲高清免费视频| 日韩精品中午字幕| 国产专区欧美精品| 久久欧美一区二区| 91在线精品一区二区三区| 亚洲特级片在线| 日本福利一区二区| 蜜桃传媒麻豆第一区在线观看| 欧美精品久久久久久久多人混战| 天堂va蜜桃一区二区三区漫画版| 欧美日韩国产另类一区| 精品一区二区免费视频| 久久久精品欧美丰满| 粉嫩av一区二区三区| 亚洲欧美在线另类| 日韩欧美一级二级三级| 激情图区综合网| 国产精品嫩草久久久久|