KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > htmlparser > util > PeekingIterator


1 // $Header: /home/cvs/jakarta-jmeter/src/htmlparser/org/htmlparser/util/PeekingIterator.java,v 1.2 2004/02/11 02:16:59 woolfel Exp $
2
/*
3  * ====================================================================
4  * Copyright 2002-2004 The Apache Software Foundation.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */

19
20 // The developers of JMeter and Apache are greatful to the developers
21
// of HTMLParser for giving Apache Software Foundation a non-exclusive
22
// license. The performance benefits of HTMLParser are clear and the
23
// users of JMeter will benefit from the hard work the HTMLParser
24
// team. For detailed information about HTMLParser, the project is
25
// hosted on sourceforge at http://htmlparser.sourceforge.net/.
26
//
27
// HTMLParser was originally created by Somik Raha in 2000. Since then
28
// a healthy community of users has formed and helped refine the
29
// design so that it is able to tackle the difficult task of parsing
30
// dirty HTML. Derrick Oswald is the current lead developer and was kind
31
// enough to assist JMeter.
32

33 package org.htmlparser.util;
34
35 import org.htmlparser.Node;
36
37 public interface PeekingIterator extends NodeIterator
38 {
39     /**
40      * Fetch a node without consuming it.
41      * Subsequent calls to <code>peek()</code> will return subsequent nodes.
42      * The node returned by <code>peek()</code> will never be a node already
43      * consumed by <code>nextHTMLNode()</code>.<p>
44      * For example, say there are nodes &lt;H1&gt;&lt;H2&gt;&lt;H3&gt;&lt;H4&gt;&lt;H5&gt;,
45      * this is the nodes that would be returned for the indicated calls:
46      * <pre>
47      * peek() H1
48      * peek() H2
49      * nextHTMLNode() H1
50      * peek() H3
51      * nextHTMLNode() H2
52      * nextHTMLNode() H3
53      * nextHTMLNode() H4
54      * peek() H5
55      * </pre>
56      * @return The next node that would be returned by <code>nextHTMLNode()</code>
57      * or the node after the last node returned by <code>peek()</code>, whichever
58      * is later in the stream. or null if there are no more nodes available via
59      * the above rules.
60      */

61     public Node peek() throws ParserException;
62 }
63
Popular Tags