Package org.htmlparser.lexer

Examples of org.htmlparser.lexer.StringSource


     */
    public void testStringSourceNull () throws IOException
    {
        Source source;

        source = new StringSource (null);
        assertTrue ("erroneous character", -1 == source.read ());
    }
View Full Code Here


     */
    public void testStringSourceEmpty () throws IOException
    {
        Source source;

        source = new StringSource ("");
        assertTrue ("erroneous character", -1 == source.read ());
    }
View Full Code Here

     */
    public void testStringSourceOneCharacter () throws IOException
    {
        Source source;

        source = new StringSource (new String ("B"));
        assertTrue ("erroneous character", 'B' == source.read ());
        assertTrue ("extra character", -1 == source.read ());
    }
View Full Code Here

     */
    public void testStringSourceClose () throws IOException
    {
        Source source;

        source = new StringSource ("hello word");
        assertTrue ("no character", -1 != source.read ());
        source.destroy ();
        try
        {
            source.read ();
View Full Code Here

        Source source;
        StringBuffer buffer;
        int c;

        reference = "Now is the time for all good men to come to the aid of the party";
        source = new StringSource (reference);
        buffer = new StringBuffer (reference.length ());
        while (-1 != (c = source.read ()))
            buffer.append ((char)c);
        assertTrue ("string incorrect", reference.equals (buffer.toString ()));
        source.reset ();
View Full Code Here

        Source source;
        StringBuffer buffer;
        int c;

        reference = "Now is the time for all good men to come to the aid of the party";
        source = new StringSource (reference);
        buffer = new StringBuffer (reference.length ());
        for (int i = 0; i < 25; i++)
            buffer.append ((char)source.read ());
        source.reset ();
        for (int i = 0; i < 25; i++)
View Full Code Here

        Source source;
        StringBuffer buffer;
        int c;

        reference = "Now is the time for all good men to come to the aid of the party";
        source = new StringSource (reference);
        assertTrue ("not markable", source.markSupported ());
        buffer = new StringBuffer (reference.length ());
        for (int i = 0; i < 25; i++)
            buffer.append ((char)source.read ());
        source.mark (88);
View Full Code Here

        part1 = "Now is the time ";
        part2 = "for all good men ";
        part3 = "to come to the aid of the party";
        reference = part1 + part2 + part3;
        source = new StringSource (reference);
        buffer = new StringBuffer (reference.length ());
        for (int i = 0; i < part1.length (); i++)
            buffer.append ((char)source.read ());
        source.skip (part2.length ());
        while (-1 != (c = source.read ()))
View Full Code Here

        String reference;
        Source source;
        char[] buffer;

        reference = "Now is the time for all good men to come to the aid of the party";
        source = new StringSource (reference);
        buffer = new char[reference.length ()];
        source.read (buffer, 0, buffer.length);
        assertTrue ("string incorrect", reference.equals (new String (buffer)));
        assertTrue ("extra character", -1 == source.read ());
        source.close ();
View Full Code Here

        part1 = "Now is the time ";
        part2 = "for all good men ";
        part3 = "to come to the aid of the party";
        reference = part1 + part2 + part3;
        source = new StringSource (reference);
        buffer = new char[reference.length ()];
        for (int i = 0; i < part1.length (); i++)
            buffer[i] = (char)source.read ();
        length = source.read (buffer, part1.length (), part2.length ());
        assertTrue ("incorrect length", part2.length () == length);
View Full Code Here

TOP

Related Classes of org.htmlparser.lexer.StringSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.