Package javax.mail.internet.HeaderTokenizer

Examples of javax.mail.internet.HeaderTokenizer.Token


        doComment(true);
        doComment(false);
    }
    public void doComment(boolean ignore) throws ParseException {
        HeaderTokenizer ht;
        Token t;
        ht =
            new HeaderTokenizer(
                "Apache(Geronimo)J2EE",
                HeaderTokenizer.RFC822,
                ignore);
        t = ht.next();
        assertEquals("Apache", t.getValue());
        assertEquals(Token.ATOM, t.getType());
        if (!ignore) {
            t = ht.next();
            assertEquals("Geronimo", t.getValue());
            assertEquals(Token.COMMENT, t.getType());
        }
        t = ht.next();
        assertEquals("J2EE", t.getValue());
        assertEquals(Token.ATOM, t.getType());
        assertEquals(Token.EOF, ht.next().getType());
    }
View Full Code Here


/**
* @version $Rev: 46019 $ $Date: 2004-09-14 04:56:06 -0500 (Tue, 14 Sep 2004) $
*/
public class HeaderTokenizerTest extends TestCase {
    public void testTokenizer() throws ParseException {
        Token t;
        HeaderTokenizer ht;
        ht =
            new HeaderTokenizer("To: \"Geronimo List\" <geronimo-dev@apache.org>, \n\r Geronimo User <geronimo-user@apache.org>");
        assertEquals("To", ht.peek().getValue());
        assertEquals("To", ht.next().getValue());
        assertEquals(":", ht.peek().getValue());
        assertEquals(":", ht.next().getValue());
        t = ht.next();
        assertEquals("Geronimo List", t.getValue());
        assertEquals(Token.QUOTEDSTRING, t.getType());
        assertEquals("<", ht.next().getValue());
        assertEquals("geronimo-dev", ht.next().getValue());
        assertEquals("@", ht.next().getValue());
        assertEquals("apache", ht.next().getValue());
        assertEquals(".", ht.next().getValue());
View Full Code Here

        doComment(true);
        doComment(false);
    }
    public void doComment(boolean ignore) throws ParseException {
        HeaderTokenizer ht;
        Token t;
        ht =
            new HeaderTokenizer(
                "Apache(Geronimo)J2EE",
                HeaderTokenizer.RFC822,
                ignore);
        t = ht.next();
        assertEquals("Apache", t.getValue());
        assertEquals(Token.ATOM, t.getType());
        if (!ignore) {
            t = ht.next();
            assertEquals("Geronimo", t.getValue());
            assertEquals(Token.COMMENT, t.getType());
        }
        t = ht.next();
        assertEquals("J2EE", t.getValue());
        assertEquals(Token.ATOM, t.getType());
        assertEquals(Token.EOF, ht.next().getType());
    }
View Full Code Here

/**
* @version $Revision: 1.3 $ $Date: 2004/03/10 10:00:30 $
*/
public class HeaderTokenizerTest extends TestCase {
    public void testTokenizer() throws ParseException {
        Token t;
        HeaderTokenizer ht;
        ht =
            new HeaderTokenizer("To: \"Geronimo List\" <geronimo-dev@apache.org>, \n\r Geronimo User <geronimo-user@apache.org>");
        assertEquals("To", ht.peek().getValue());
        assertEquals("To", ht.next().getValue());
        assertEquals(":", ht.peek().getValue());
        assertEquals(":", ht.next().getValue());
        t = ht.next();
        assertEquals("Geronimo List", t.getValue());
        assertEquals(Token.QUOTEDSTRING, t.getType());
        assertEquals("<", ht.next().getValue());
        assertEquals("geronimo-dev", ht.next().getValue());
        assertEquals("@", ht.next().getValue());
        assertEquals("apache", ht.next().getValue());
        assertEquals(".", ht.next().getValue());
View Full Code Here

        doComment(true);
        doComment(false);
    }
    public void doComment(boolean ignore) throws ParseException {
        HeaderTokenizer ht;
        Token t;
        ht =
            new HeaderTokenizer(
                "Apache(Geronimo)J2EE",
                HeaderTokenizer.RFC822,
                ignore);
        t = ht.next();
        assertEquals("Apache", t.getValue());
        assertEquals(Token.ATOM, t.getType());
        if (!ignore) {
            t = ht.next();
            assertEquals("Geronimo", t.getValue());
            assertEquals(Token.COMMENT, t.getType());
        }
        t = ht.next();
        assertEquals("J2EE", t.getValue());
        assertEquals(Token.ATOM, t.getType());
        assertEquals(Token.EOF, ht.next().getType());
    }
View Full Code Here

        if (encoding != null) {
            // we need to parse this into ATOMs and other constituent parts.  We want the first
            // ATOM token on the string.
            HeaderTokenizer tokenizer = new HeaderTokenizer(encoding, HeaderTokenizer.MIME);

            Token token = tokenizer.next();
            while (token.getType() != Token.EOF) {
                // if this is an ATOM type, return it.
                if (token.getType() == Token.ATOM) {
                    return token.getValue();
                }
            }
            // not ATOMs found, just return the entire header value....somebody might be able to make sense of
            // this.
            return encoding;
View Full Code Here

/**
* @version $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $
*/
public class HeaderTokenizerTest extends TestCase {
    public void testTokenizer() throws ParseException {
        Token t;
        HeaderTokenizer ht;
        ht =
            new HeaderTokenizer("To: \"Geronimo List\" <geronimo-dev@apache.org>, \n\r Geronimo User <geronimo-user@apache.org>");
        assertEquals("To", ht.peek().getValue());
        assertEquals("To", ht.next().getValue());
        assertEquals(":", ht.peek().getValue());
        assertEquals(":", ht.next().getValue());
        t = ht.next();
        assertEquals("Geronimo List", t.getValue());
        assertEquals(Token.QUOTEDSTRING, t.getType());
        assertEquals("<", ht.next().getValue());
        assertEquals("geronimo-dev", ht.next().getValue());
        assertEquals("@", ht.next().getValue());
        assertEquals("apache", ht.next().getValue());
        assertEquals(".", ht.next().getValue());
View Full Code Here

        doComment(true);
        doComment(false);
    }
    public void doComment(boolean ignore) throws ParseException {
        HeaderTokenizer ht;
        Token t;
        ht =
            new HeaderTokenizer(
                "Apache(Geronimo)J2EE",
                HeaderTokenizer.RFC822,
                ignore);
        t = ht.next();
        assertEquals("Apache", t.getValue());
        assertEquals(Token.ATOM, t.getType());
        if (!ignore) {
            t = ht.next();
            assertEquals("Geronimo", t.getValue());
            assertEquals(Token.COMMENT, t.getType());
        }
        t = ht.next();
        assertEquals("J2EE", t.getValue());
        assertEquals(Token.ATOM, t.getType());
        assertEquals(Token.EOF, ht.next().getType());
    }
View Full Code Here

        if (encoding != null) {
            // we need to parse this into ATOMs and other constituent parts.  We want the first
            // ATOM token on the string.
            HeaderTokenizer tokenizer = new HeaderTokenizer(encoding, HeaderTokenizer.MIME);

            Token token = tokenizer.next();
            while (token.getType() != Token.EOF) {
                // if this is an ATOM type, return it.
                if (token.getType() == Token.ATOM) {
                    return token.getValue();
                }
            }
            // not ATOMs found, just return the entire header value....somebody might be able to make sense of
            // this.
            return encoding;
View Full Code Here

        if (encoding != null) {
            // we need to parse this into ATOMs and other constituent parts.  We want the first
            // ATOM token on the string.
            HeaderTokenizer tokenizer = new HeaderTokenizer(encoding, HeaderTokenizer.MIME);

            Token token = tokenizer.next();
            while (token.getType() != Token.EOF) {
                // if this is an ATOM type, return it.
                if (token.getType() == Token.ATOM) {
                    return token.getValue();
                }
            }
            // not ATOMs found, just return the entire header value....somebody might be able to make sense of
            // this.
            return encoding;
View Full Code Here

TOP

Related Classes of javax.mail.internet.HeaderTokenizer.Token

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.