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

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

?? stringbean.java

?? cms是開源的框架
?? JAVA
字號:

package org.opencms.util;

import java.io.Serializable;

import org.htmlparser.Node;
import org.htmlparser.Tag;
import org.htmlparser.Text;
import org.htmlparser.tags.LinkTag;
import org.htmlparser.util.Translate;
import org.htmlparser.visitors.NodeVisitor;

/**
 * Extracts the HTML page content.<p>
 */
public class StringBean extends NodeVisitor implements Serializable {

    /**
     * A newline.
     */
    private static final String NEWLINE = System.getProperty("line.separator");

    /**
     * The length of the NEWLINE.
     */
    private static final int NEWLINE_SIZE = NEWLINE.length();

    private static final long serialVersionUID = 1596190888769126925L;

    /**
     * The buffer text is stored in while traversing the HTML.
     */
    protected StringBuffer m_buffer;

    /**
     * If <code>true</code> sequences of whitespace characters are replaced
     * with a single space character.
     */
    protected boolean m_collapse;

    /**
     * Set <code>true</code> when traversing a PRE tag.
     */
    protected boolean m_isPre;

    /**
     * Set <code>true</code> when traversing a SCRIPT tag.
     */
    protected boolean m_isScript;

    /**
     * Set <code>true</code> when traversing a STYLE tag.
     */
    protected boolean m_isStyle;

    /**
     * If <code>true</code> the link URLs are embedded in the text output.
     */
    protected boolean m_links;

    /**
     * The strings extracted from the URL.
     */
    protected String m_strings;

    /**
     * Create a StringBean object.
     * Default property values are set to 'do the right thing':
     * <p><code>Links</code> is set <code>false</code> so text appears like a
     * browser would display it, albeit without the colour or underline clues
     * normally associated with a link.</p>
     * <p><code>ReplaceNonBreakingSpaces</code> is set <code>true</code>, so
     * that printing the text works, but the extra information regarding these
     * formatting marks is available if you set it false.</p>
     * <p><code>Collapse</code> is set <code>true</code>, so text appears
     * compact like a browser would display it.</p>
     */
    public StringBean() {

        super(true, true);
        m_strings = null;
        m_links = false;
        m_collapse = true;
        m_buffer = new StringBuffer(4096);
        m_isScript = false;
        m_isPre = false;
        m_isStyle = false;
    }

    /**
     * Get the current 'collapse whitespace' state.
     * If set to <code>true</code> this emulates the operation of browsers
     * in interpretting text where <quote>user agents should collapse input
     * white space sequences when producing output inter-word space</quote>.
     * See HTML specification section 9.1 White space
     * <a href="http://www.w3.org/TR/html4/struct/text.html#h-9.1">
     * http://www.w3.org/TR/html4/struct/text.html#h-9.1</a>.
     * @return <code>true</code> if sequences of whitespace (space '&#92;u0020',
     * tab '&#92;u0009', form feed '&#92;u000C', zero-width space '&#92;u200B',
     * carriage-return '\r' and NEWLINE '\n') are to be replaced with a single
     * space.
     */
    public boolean getCollapse() {

        return (m_collapse);
    }

    /**
     * Get the current 'include links' state.
     * @return <code>true</code> if link text is included in the text extracted
     * from the URL, <code>false</code> otherwise.
     */
    public boolean getLinks() {

        return (m_links);
    }

    /**
     * Return the textual contents of the URL.
     * This is the primary output of the bean.
     * @return The user visible (what would be seen in a browser) text.
     */
    public String getStrings() {

        if (null == m_strings) {
            if (0 == m_buffer.length()) {
                setStrings();
            } else {
                updateStrings(m_buffer.toString());
            }
        }

        return (m_strings);
    }

    /**
     * Set the current 'collapse whitespace' state.
     * If the setting is changed after the URL has been set, the text from the
     * URL will be reacquired, which is possibly expensive.
     * @param collapse If <code>true</code>, sequences of whitespace
     * will be reduced to a single space.
     */
    public void setCollapse(boolean collapse) {

        boolean oldValue = m_collapse;
        if (oldValue != collapse) {
            m_collapse = collapse;
            setStrings();
        }
    }

    /**
     * Set the 'include links' state.
     * If the setting is changed after the URL has been set, the text from the
     * URL will be reacquired, which is possibly expensive.
     * @param links Use <code>true</code> if link text is to be included in the
     * text extracted from the URL, <code>false</code> otherwise.
     */
    public void setLinks(boolean links) {

        boolean oldValue = m_links;
        if (oldValue != links) {
            m_links = links;
            setStrings();
        }
    }

    /**
     * Resets the state of the PRE and SCRIPT flags.
     * @param tag The end tag to process.
     */
    public void visitEndTag(Tag tag) {
        
        Node parent = tag.getParent();
        if (parent instanceof LinkTag) {
            if (getLinks()) { // appends the link as text between angle brackets to the output.
                m_buffer.append(" <");
                m_buffer.append(((LinkTag)parent).getLink());
                m_buffer.append(">");
            }
        }  
        
        String name = tag.getTagName().toUpperCase();
        if (name.equals("PRE")) {
            m_isPre = false;
        } else if (name.equals("SCRIPT")) {
            m_isScript = false;
        } else if (name.equals("STYLE")) {
            m_isStyle = false;
        }
        
        if (isHeadTag(name)) {
            carriageReturn();
            carriageReturn(true);
        }
        
        if (isTitleTag(name)) {
            m_buffer.append(" ]");            
            carriageReturn();
            carriageReturn(true);
        }
    }

    private boolean isTitleTag(String name) {
        
        return "TITLE".equals(name);
    }
    
    private boolean isHeadTag(String name) {

        return "H1".equals(name)
            || "H2".equals(name)
            || "H3".equals(name)
            || "H4".equals(name)
            || "H5".equals(name)
            || "H6".equals(name);
    }

    /**
     * Appends the text to the output.
     * @param string The text node.
     */
    public void visitStringNode(Text string) {

        if (!m_isScript && !m_isStyle) {
            String text = string.getText();
            if (!m_isPre) {
                text = Translate.decode(text);
                text = text.replace('\u00a0', ' ');
                if (getCollapse()) {
                    collapse(m_buffer, text);
                } else {
                    m_buffer.append(text);
                }
            } else {
                m_buffer.append(text);
            }
        }
    }

    /**
     * Appends a NEWLINE to the output if the tag breaks flow, and
     * possibly sets the state of the PRE and SCRIPT flags.
     * @param tag The tag to examine.
     */
    public void visitTag(Tag tag) {
            
        String name = tag.getTagName();
        if (name.equalsIgnoreCase("PRE")) {
            m_isPre = true;
        } else if (name.equalsIgnoreCase("SCRIPT")) {
            m_isScript = true;
        } else if (name.equalsIgnoreCase("STYLE")) {
            m_isStyle = true;
        }
        
        if (isHeadTag(name)) {
            carriageReturn(true);
            m_buffer.append("* ");
        } else if (isTitleTag(name)) { 
            m_buffer.append("[ ");        
        } else {
            if (tag.breaksFlow()) {
                carriageReturn();
            }
        }
        
    }

    /**
     * Appends a newline to the buffer if there isn't one there already.
     * Except if the buffer is empty.
     */
    protected void carriageReturn() {

        carriageReturn(false);
    }

    /**
     * Appends a newline to the buffer if there isn't one there already.
     * Except if the buffer is empty.
     * 
     * @param check a parameter the developer forgot to comment
     */
    protected void carriageReturn(boolean check) {

        int length;

        length = m_buffer.length();
        if ((0 != length) // don't append newlines to the beginning of a buffer
            && (check || ((NEWLINE_SIZE <= length) // not enough chars to hold a NEWLINE
            && (!m_buffer.substring(length - NEWLINE_SIZE, length).equals(NEWLINE))))) {

            m_buffer.append(NEWLINE);
        }
    }
    
    /**
     * Add the given text collapsing whitespace.
     * Use a little finite state machine:
     * <pre>
     * state 0: whitepace was last emitted character
     * state 1: in whitespace
     * state 2: in word
     * A whitespace character moves us to state 1 and any other character
     * moves us to state 2, except that state 0 stays in state 0 until
     * a non-whitespace and going from whitespace to word we emit a space
     * before the character:
     *    input:     whitespace   other-character
     * state\next
     *    0               0             2
     *    1               1        space then 2
     *    2               1             2
     * </pre>
     * @param buffer The buffer to append to.
     * @param string The string to append.
     */
    protected void collapse(StringBuffer buffer, String string) {

        int chars;
        int length;
        int state;
        char character;

        chars = string.length();
        if (0 != chars) {
            length = buffer.length();
            state = ((0 == length) || (buffer.charAt(length - 1) == ' ') || ((NEWLINE_SIZE <= length) && buffer.substring(
                length - NEWLINE_SIZE,
                length).equals(NEWLINE))) ? 0 : 1;
            for (int i = 0; i < chars; i++) {
                character = string.charAt(i);
                switch (character) {
                    // see HTML specification section 9.1 White space
                    // http://www.w3.org/TR/html4/struct/text.html#h-9.1
                    case '\u0020':
                    case '\u0009':
                    case '\u000C':
                    case '\u200B':
                    case '\r':
                    case '\n':
                        if (0 != state) {
                            state = 1;
                        }
                        break;
                    default:
                        if (1 == state) {
                            buffer.append(' ');
                        }
                        state = 2;
                        buffer.append(character);
                }
            }
        }
    }

    /**
     * Fetch the URL contents.
     * Only do work if there is a valid parser with it's URL set.
     */
    protected void setStrings() {

        m_strings = null;
        m_buffer = new StringBuffer(4096);
    }

    /**
     * Assign the <code>Strings</code> property, firing the property change.
     * @param strings The new value of the <code>Strings</code> property.
     */
    protected void updateStrings(String strings) {

        if ((null == m_strings) || !m_strings.equals(strings)) {
            m_strings = strings;
        }
    }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区欧美在线观看| 在线免费一区三区| 久久久影视传媒| 国产一区二区伦理片| 久久精品视频在线看| 成人黄色777网| 亚洲精品视频自拍| 91精品国产综合久久久久| 美女视频网站久久| 久久精品夜夜夜夜久久| 成人黄色电影在线 | 91精品国产综合久久精品图片| 色999日韩国产欧美一区二区| 欧美系列在线观看| 日韩高清在线观看| 精品国产一区二区三区av性色 | 精品裸体舞一区二区三区| 国内成人精品2018免费看| 国产精品亲子乱子伦xxxx裸| 成人免费视频caoporn| 亚洲一区视频在线| 日韩小视频在线观看专区| 国产精品123| 亚洲制服丝袜一区| 久久亚洲精精品中文字幕早川悠里 | 日本成人在线网站| 久久久久综合网| 欧美在线观看一区二区| 韩国av一区二区三区四区| 中文字幕一区二区三区在线不卡| 首页国产欧美日韩丝袜| 国产拍欧美日韩视频二区| 一本一本久久a久久精品综合麻豆| 日韩欧美一级二级三级| jlzzjlzz亚洲女人18| 蜜臀va亚洲va欧美va天堂| 中文字幕免费一区| 日韩视频在线一区二区| 一本久久a久久免费精品不卡| 国产片一区二区| 日韩一区二区三区在线视频| 国产91在线|亚洲| 性感美女极品91精品| 欧美韩国日本不卡| 欧美一区二区三区公司| 色综合久久中文综合久久牛| 国内精品久久久久影院色| 亚洲超丰满肉感bbw| 亚洲欧洲成人精品av97| 337p日本欧洲亚洲大胆精品 | 美国十次了思思久久精品导航| 91福利在线导航| 国产成人亚洲综合a∨猫咪| 午夜精品久久久久久不卡8050| 在线欧美日韩国产| 国产精品白丝jk黑袜喷水| 男女激情视频一区| 午夜精品久久久久久久99樱桃 | 日韩欧美aaaaaa| 欧美午夜不卡视频| 972aa.com艺术欧美| 国产麻豆视频精品| 午夜影院久久久| 亚洲一区二区在线观看视频| 一区在线观看视频| 国产精品美女www爽爽爽| 精品剧情在线观看| 欧美成人一区二区三区| 91精品婷婷国产综合久久 | 精品成a人在线观看| 91精品国产综合久久精品 | 久久99精品视频| 秋霞成人午夜伦在线观看| 亚洲精品免费在线| 亚洲免费毛片网站| 亚洲综合色在线| 香蕉av福利精品导航| 丝袜亚洲另类丝袜在线| 日韩**一区毛片| 久久精品国内一区二区三区| 久久66热偷产精品| 国产盗摄一区二区| 不卡一区在线观看| 色婷婷一区二区三区四区| 色综合久久久久综合体| 在线观看亚洲专区| 制服丝袜中文字幕亚洲| 日韩视频一区在线观看| 久久亚洲免费视频| 欧美bbbbb| 国精产品一区一区三区mba视频| 亚洲黄色免费网站| 天堂精品中文字幕在线| 免费成人小视频| 国产ts人妖一区二区| 91色九色蝌蚪| 91精品一区二区三区久久久久久| 国产乱码字幕精品高清av| 国产suv精品一区二区三区| 国产成人无遮挡在线视频| 色哟哟一区二区| 欧美一区二区精美| 国产精品色一区二区三区| 一区二区在线免费观看| 免费高清在线一区| 成人免费看的视频| 欧美日韩黄色影视| 久久久久久综合| 亚洲精品国产a久久久久久| 奇米一区二区三区av| 国产精华液一区二区三区| 91成人在线精品| 337p日本欧洲亚洲大胆色噜噜| 5月丁香婷婷综合| 久久久久久久精| 亚洲精品视频一区二区| 乱一区二区av| 91精品福利在线| 久久综合五月天婷婷伊人| 亚洲精品ww久久久久久p站| 蜜臂av日日欢夜夜爽一区| 成熟亚洲日本毛茸茸凸凹| 欧美日韩你懂得| 中文一区二区完整视频在线观看 | 久久精品夜夜夜夜久久| 亚洲一区在线观看免费 | 91精品国产91久久久久久一区二区| 色8久久人人97超碰香蕉987| 欧美一级在线免费| 亚洲精品第一国产综合野| 国产伦精品一区二区三区视频青涩| 奇米精品一区二区三区在线观看一 | av激情成人网| 日韩女优电影在线观看| 亚洲一区二区偷拍精品| 国产激情一区二区三区四区 | 日本视频一区二区| 91女人视频在线观看| wwwwxxxxx欧美| 亚洲主播在线观看| 不卡一区二区在线| 精品国产乱码久久久久久蜜臀 | 国产精品久久99| 国产综合一区二区| 91麻豆精品国产91久久久使用方法 | 欧美亚洲禁片免费| 日本一区二区在线不卡| 激情小说亚洲一区| 欧美日韩国产影片| 一个色在线综合| 91同城在线观看| 国产精品久久久久久久久图文区| 日韩毛片在线免费观看| 国产成人午夜99999| 精品少妇一区二区三区视频免付费| 26uuu色噜噜精品一区二区| 蜜臀av性久久久久蜜臀aⅴ四虎| 精品一区二区三区免费毛片爱| 国产美女在线精品| 精品人伦一区二区色婷婷| 免费欧美高清视频| 欧美一级黄色录像| 久色婷婷小香蕉久久| 91精品国产麻豆| 另类小说欧美激情| 日韩亚洲电影在线| 久久精品国产免费| 亚洲精品一区二区三区福利 | 99re66热这里只有精品3直播| 色视频欧美一区二区三区| 中文字幕乱码一区二区免费| 国产成人在线看| 国产精品国产三级国产aⅴ无密码 国产精品国产三级国产aⅴ原创 | 蜜桃视频第一区免费观看| 91精品免费在线观看| 麻豆成人av在线| 欧美mv和日韩mv的网站| 久久精品久久精品| 日本一区二区综合亚洲| 99视频国产精品| 一区二区三区不卡视频| 欧美日韩另类一区| 日本不卡免费在线视频| 精品国产人成亚洲区| 国产成人av电影免费在线观看| 在线观看91视频| 日本特黄久久久高潮| 欧美成人艳星乳罩| 风间由美性色一区二区三区| 国产精品久久久久久久久免费相片| 青青国产91久久久久久| 欧美精品一区二区三| 国产成人精品影院| 亚洲精品国产精品乱码不99 | 日本一区二区动态图| 99久久免费精品高清特色大片| 欧美电影免费观看高清完整版在线| 亚洲人成人一区二区在线观看| 国产一区在线观看麻豆| 国产精品免费人成网站|