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

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

?? filtercodehighlight.java

?? 這是學習Java必須讀懂兩套源代碼
?? JAVA
字號:
/**
 * Copyright (C) 2001 Yasna.com. All rights reserved.
 *
 * ===================================================================
 * The Apache Software License, Version 1.1
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. The end-user documentation included with the redistribution,
 *    if any, must include the following acknowledgment:
 *       "This product includes software developed by
 *        Yasna.com (http://www.yasna.com)."
 *    Alternately, this acknowledgment may appear in the software itself,
 *    if and wherever such third-party acknowledgments normally appear.
 *
 * 4. The names "Yazd" and "Yasna.com" must not be used to
 *    endorse or promote products derived from this software without
 *    prior written permission. For written permission, please
 *    contact yazd@yasna.com.
 *
 * 5. Products derived from this software may not be called "Yazd",
 *    nor may "Yazd" appear in their name, without prior written
 *    permission of Yasna.com.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL YASNA.COM OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * ====================================================================
 *
 * This software consists of voluntary contributions made by many
 * individuals on behalf of Yasna.com. For more information
 * on Yasna.com, please see <http://www.yasna.com>.
 */

/**
 * Copyright (C) 2000 CoolServlets.com. All rights reserved.
 *
 * ===================================================================
 * The Apache Software License, Version 1.1
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. The end-user documentation included with the redistribution,
 *    if any, must include the following acknowledgment:
 *       "This product includes software developed by
 *        CoolServlets.com (http://www.coolservlets.com)."
 *    Alternately, this acknowledgment may appear in the software itself,
 *    if and wherever such third-party acknowledgments normally appear.
 *
 * 4. The names "Jive" and "CoolServlets.com" must not be used to
 *    endorse or promote products derived from this software without
 *    prior written permission. For written permission, please
 *    contact webmaster@coolservlets.com.
 *
 * 5. Products derived from this software may not be called "Jive",
 *    nor may "Jive" appear in their name, without prior written
 *    permission of CoolServlets.com.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL COOLSERVLETS.COM OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * ====================================================================
 *
 * This software consists of voluntary contributions made by many
 * individuals on behalf of CoolServlets.com. For more information
 * on CoolServlets.com, please see <http://www.coolservlets.com>.
 */

package com.Yasna.forum.filter;

import java.io.*;
import java.util.*;
import com.Yasna.forum.*;
import com.Yasna.codeviewer.*;

/**
 * A ForumMessageFilter that syntax highlights Java code appearing between
 * [code][/code] tags in the body of ForumMessage.
 */
public class FilterCodeHighlight extends ForumMessageFilter
        implements Serializable
{

    private static final String NEW_LINE = System.getProperty("line.separator");

    /**
     * Property values of the filter.
     */
    private Properties props;

    /**
     * Property descriptions of the filter.
     */
    private Properties propDescriptions;

    /**
     * Much of the work of this filter is done by a CodeViewer object. We
     * make it a transient variable since there is no reason to serialize it.
     */
    private transient CodeViewer cv;

    /**
     * Creates a new filter not associated with a message. This is
     * generally only useful for defining a template filter that other
     * fitlers will be cloned from.
     */
    public FilterCodeHighlight() {
        super();
        props = new Properties();
        propDescriptions = new Properties();
        cv = new CodeViewer();
        initializeProperties();
    }

    /**
     * Creates a new filter wrapped around the specified message. This
     * constructor is normally called when cloning a filter template.
     *
     * @param message the ForumMessage to wrap the new filter around.
     * @param properties the property values for the filter.
     * @param propertyDescriptions the property descriptions for the filter.
     */
    public FilterCodeHighlight(ForumMessage message, Properties properties,
            Properties propertyDescriptions)
    {
        super(message);
        this.props = new Properties(properties);
        this.propDescriptions = new Properties(propertyDescriptions);
        cv = new CodeViewer();
        applyProperties();
    }

    /**
     * Clones a new filter that will have the same properties and that
     * will wrap around the specified message.
     *
     * @param message the ForumMessage to wrap the new filter around.
     */
    public ForumMessageFilter clone(ForumMessage message){
        return new FilterCodeHighlight(message, props, propDescriptions);
    }

    /**
     * Returns the name of the filter.
     */
    public String getName() {
        return "Java Code Syntax Highlighter";
    }

    /**
     * Returns a description of the filter.
     */
    public String getDescription() {
        return "Highlights Java code that appears between [code][/code] tags";
    }

    /**
     * Returns the author of the filter.
     */
    public String getAuthor() {
        return "CoolServlets.com";
    }

    /**
     * Returns the major version number of the filter.
     */
    public int getMajorVersion() {
        return 1;
    }

    /**
     * Returns the minor version number of the filter.
     */
    public int getMinorVersion() {
        return 0;
    }

    /**
     * Returns the value of a property of the filter.
     *
     * @param name the name of the property.
     * @returns the value of the property.
     */
    public String getFilterProperty(String name) {
        return props.getProperty(name);
    }

    /**
     * Returns the description of a property of the filter.
     *
     * @param name the name of the property.
     * @return the description of the property.
     */
    public String getFilterPropertyDescription(String name) {
        return propDescriptions.getProperty(name);
    }

    /**
     * Returns an Enumeration of all the property names.
     */
    public Enumeration filterPropertyNames() {
        return props.propertyNames();
    }

    /**
     * Sets a property of the filter. Each filter has a set number of
     * properties that are determined by the filter author. 
     *
     * @param name the name of the property to set.
     * @param value the new value for the property.
     *
     * @throws IllegalArgumentException if the property trying to be set doesn't
     *    exist.
     */
    public void setFilterProperty(String name, String value)
            throws IllegalArgumentException
    {
        if (props.getProperty(name) == null) {
            throw new IllegalArgumentException();
        }
        props.put(name, value);
        applyProperties();
    }

    /**
     * <b>Overloaded</b> to return the body of message with Java code between
     * [code] [/code] tags syntax highlighted.
     */
    public String getBody() {
        return highlightCode(message.getBody());
    }

    /**
     * Creates properties and sets their descriptions.
     */
    private void initializeProperties() {
        props.put("commentStart",cv.getCommentStart());
        props.put("commentEnd",cv.getCommentEnd());
        props.put("stringStart",cv.getStringStart());
        props.put("stringEnd",cv.getStringEnd());
        props.put("reservedWordStart",cv.getReservedWordStart());
        props.put("reservedWordEnd",cv.getReservedWordEnd());

        propDescriptions.put("commentStart","A HTML start tag that determines how comments will be displayed");
        propDescriptions.put("commentEnd","A HTML end tag that should correspond to the commentStart tag");
        propDescriptions.put("stringStart","A HTML start tag that determines how strings will be displayed");
        propDescriptions.put("stringEnd","A HTML end tag that should correspond to the stringStart tag");
        propDescriptions.put("reservedWordStart","A HTML start tag that determines how reserved words will be displayed");
        propDescriptions.put("reservedWordEnd","A HTML end tag that should correspond to the reservedWordStart tag");
    }

    private void applyProperties() {
        cv.setCommentStart(props.getProperty("commentStart"));
        cv.setCommentEnd(props.getProperty("commentEnd"));
        cv.setStringStart(props.getProperty("stringStart"));
        cv.setStringEnd(props.getProperty("stringEnd"));
        cv.setReservedWordStart(props.getProperty("reservedWordStart"));
        cv.setReservedWordEnd(props.getProperty("reservedWordEnd"));
    }

    /**
    * This method takes a string which may contain Java code.
    * The Java code will be highlighted.
    *
    * @param input The text to be converted.
    * @return The input string with any Java code highlighted.
    */
    private String highlightCode( String input ) {
        // Check if the string is null or zero length -- if so, return what was sent in.
        if( input == null || input.length() == 0 ) {
            return input;
        }
        else {
            StringBuffer buf = new StringBuffer();
            int i = 0, j = 0, oldend = 0;

            while ( ( i=input.indexOf( "[code]", oldend ) ) >= 0 ) {
                //Check to see where the ending code tag is and store than in j
                if ( (j=input.indexOf( "[/code]", i+6 ) ) < 0)  {
                    //End at end of input if no closing tag is given
                    j = input.length()-7;
                }
                // Take the string up to the code, append the string returned by CodeViewer
                buf.append(input.substring(oldend,i));
                buf.append("<pre>");
                //Read line by line and filter accordingly.
                //StringTokenizer tokens = new StringTokenizer(input.substring(i+6,j-1), NEW_LINE);
                StringTokenizer tokens = new StringTokenizer(input.substring(i+6,j), NEW_LINE);
                while (tokens.hasMoreTokens()) {
                    buf.append(cv.syntaxHighlight(tokens.nextToken()));
                    buf.append(NEW_LINE);
                }
                buf.append("</pre>");
                // Next time, want to start looking after ending [/code] tag
                oldend = j+7;
            }
            buf.append(input.substring(oldend,input.length()));
            return buf.toString();
        }
    }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲精品亚洲人成人网在线播放| 中文字幕精品一区二区三区精品| 免费成人在线影院| 久久综合九色综合欧美就去吻| 国产呦萝稀缺另类资源| 中文字幕精品—区二区四季| 99re热视频这里只精品| 亚洲一级二级三级在线免费观看| 3atv在线一区二区三区| 韩国成人精品a∨在线观看| 国产精品久久久久一区二区三区 | 九一九一国产精品| 亚洲三级理论片| 日韩欧美一区二区免费| 99精品久久99久久久久| 免费人成黄页网站在线一区二区| 国产喷白浆一区二区三区| 97精品电影院| 久久久久高清精品| 色国产综合视频| 美女视频黄免费的久久| 中文字幕乱码日本亚洲一区二区 | 7777精品伊人久久久大香线蕉完整版 | 日韩影视精彩在线| 国产欧美日韩久久| 91浏览器打开| 亚洲va在线va天堂| 国产日韩欧美精品在线| 欧美人妖巨大在线| 国产精品99久久久久久宅男| 亚洲午夜精品久久久久久久久| 欧美成人vr18sexvr| 色综合久久综合| 精品一区二区精品| 无码av免费一区二区三区试看| 亚洲精品第一国产综合野| 国产高清久久久久| 伊人夜夜躁av伊人久久| 欧美videos中文字幕| 欧美日韩视频一区二区| 麻豆精品一区二区综合av| 亚洲日本丝袜连裤袜办公室| 精品国产亚洲一区二区三区在线观看| 色综合欧美在线视频区| 国产精品综合在线视频| 天堂蜜桃91精品| 亚洲一区二区欧美激情| 国产精品国产三级国产普通话99| 久久综合色鬼综合色| 日韩一区二区在线观看视频播放| 欧美性感一类影片在线播放| 国产乱码精品一区二区三区av| 日韩av一区二区在线影视| 夜夜爽夜夜爽精品视频| 亚洲摸摸操操av| 51久久夜色精品国产麻豆| 久久久久久麻豆| 日韩午夜激情电影| 日韩一二在线观看| 日韩精品中文字幕在线一区| 日韩午夜激情免费电影| 欧美不卡在线视频| 精品国产1区二区| 国产午夜亚洲精品理论片色戒| 精品88久久久久88久久久| 久久精品一区二区三区av| 精品国产亚洲在线| 中文字幕高清一区| 伊人性伊人情综合网| 亚洲成人动漫在线免费观看| 五月婷婷综合网| 九九国产精品视频| 成人v精品蜜桃久久一区| 色成人在线视频| 欧美老女人第四色| 99精品热视频| 成人免费av资源| 国产一区不卡精品| 成人av网站免费观看| 欧美影院精品一区| 欧美精品一区男女天堂| 中文字幕一区二区三| 亚洲成va人在线观看| 国产精品综合一区二区| 欧美写真视频网站| 欧美精品久久久久久久多人混战| 欧美高清在线一区| 美女脱光内衣内裤视频久久影院| 高潮精品一区videoshd| 欧美日韩国产中文| 国产欧美一区二区三区沐欲| 亚洲一区视频在线| 国产黄色91视频| 欧美一级高清片| 日本一区二区三区四区在线视频 | 99久久婷婷国产综合精品电影| 波多野结衣在线aⅴ中文字幕不卡| 欧美日韩一级二级| 中文字幕 久热精品 视频在线| 亚洲综合久久久久| 美国十次综合导航| 欧美午夜一区二区三区| 国产精品久久看| 久久国产视频网| 欧美精品自拍偷拍| 一区二区三区中文免费| 国产91丝袜在线观看| 精品人伦一区二区色婷婷| 性欧美大战久久久久久久久| 91丨porny丨户外露出| 国产视频不卡一区| 国产精品888| 久久久久九九视频| 日本午夜精品一区二区三区电影| 色8久久人人97超碰香蕉987| 综合久久国产九一剧情麻豆| 麻豆精品视频在线观看| 国产精品一区二区在线播放| 91在线视频在线| 久久男人中文字幕资源站| 蜜臀av一级做a爰片久久| 91麻豆精品国产91久久久久久| 亚洲夂夂婷婷色拍ww47| 欧美日韩久久久| 无吗不卡中文字幕| 日韩女优av电影在线观看| 久久精品国产成人一区二区三区| 精品福利视频一区二区三区| 国产一区二区精品久久| 国产精品美女一区二区三区| av激情综合网| 亚洲一区在线看| 日韩欧美在线观看一区二区三区| 青青草原综合久久大伊人精品优势| 欧美一级日韩一级| 国产精品羞羞答答xxdd| 国产精品伦一区| 欧美精选在线播放| 国产高清不卡二三区| 国产日韩精品一区二区三区在线| 国产一区二区三区香蕉| 国产日韩精品一区二区浪潮av| a4yy欧美一区二区三区| 亚洲精品自拍动漫在线| 日韩一区二区视频| 99re视频这里只有精品| 丁香婷婷综合色啪| 亚洲一二三四在线| 久久综合久久99| 欧美午夜精品久久久久久超碰| 奇米精品一区二区三区四区| 中文字幕中文乱码欧美一区二区| 欧美日韩在线免费视频| 国产精品资源站在线| 亚洲成人精品在线观看| 久久久久国产一区二区三区四区 | 亚洲欧美综合在线精品| 91精品国产一区二区| 91免费在线视频观看| 国产美女在线观看一区| 偷拍一区二区三区| 日韩理论电影院| 欧美国产日韩a欧美在线观看| 8x福利精品第一导航| 色婷婷综合久久久中文一区二区| 激情深爱一区二区| 日韩成人一级片| 亚洲电影你懂得| 亚洲在线观看免费| 亚洲日本护士毛茸茸| 日韩美女视频一区二区在线观看| 在线视频国内自拍亚洲视频| 成人黄色国产精品网站大全在线免费观看 | 亚洲免费在线观看| 亚洲精品成a人| 午夜成人免费视频| 日韩av一二三| 久久精品国产**网站演员| 国产在线精品视频| 成人免费观看视频| 一本久久精品一区二区| 欧美午夜片在线观看| 在线不卡免费欧美| 欧美一区二区三区免费视频| 日韩一级黄色片| 国产精品污www在线观看| 亚洲午夜激情av| 亚洲综合小说图片| 奇米影视一区二区三区| 国产真实精品久久二三区| 粉嫩高潮美女一区二区三区| jizz一区二区| 91精品国产欧美一区二区18| 国产校园另类小说区| 悠悠色在线精品| 国产美女一区二区| 欧美在线观看视频一区二区三区| 欧美二区三区91| 国产精品久久久久久久久久久免费看 | 日韩欧美的一区二区|