Package org.apache.james.mime4j.util

Examples of org.apache.james.mime4j.util.ByteSequence


import org.apache.james.mime4j.util.ContentUtil;

public class ContentDispositionFieldTest extends TestCase {

    static ContentDispositionField parse(final String s) throws MimeException {
        ByteSequence raw = ContentUtil.encode(s);
        RawField rawField = RawFieldParser.DEFAULT.parseField(raw);
        return ContentDispositionFieldImpl.PARSER.parse(rawField, null);
    }
View Full Code Here


import org.apache.james.mime4j.util.ContentUtil;

public class LenientMimeVersionParserTest extends TestCase {

    static MimeVersionField parse(final String s) throws MimeException {
        ByteSequence raw = ContentUtil.encode(s);
        RawField rawField = RawFieldParser.DEFAULT.parseField(raw);
        return MimeVersionFieldLenientImpl.PARSER.parse(rawField, null);
    }
View Full Code Here

        }
    }

    public static String decode(Field f) throws IOException {
        String s = null;
        ByteSequence raw = f.getRaw();
        if (raw != null) {
            s = ContentUtil.decode(raw);
        }
        if (s == null) {
            StringBuilder buf = new StringBuilder();
View Full Code Here

import junit.framework.TestCase;

public class LenientContentTypeFieldTest extends TestCase {

    static ContentTypeField parse(final String s) throws MimeException {
        ByteSequence raw = ContentUtil.encode(s);
        RawField rawField = RawFieldParser.DEFAULT.parseField(raw);
        return ContentTypeFieldLenientImpl.PARSER.parse(rawField, null);
    }
View Full Code Here

import junit.framework.TestCase;

public class ContentLocationFieldTest extends TestCase {

    static ContentLocationField parse(final String s) throws MimeException {
        ByteSequence raw = ContentUtil.encode(s);
        RawField rawField = RawFieldParser.DEFAULT.parseField(raw);
        return ContentLocationFieldImpl.PARSER.parse(rawField, null);
    }
View Full Code Here

import junit.framework.TestCase;

public class ContentTransferEncodingFieldTest extends TestCase {

    static ContentTransferEncodingField parse(final String s) throws MimeException {
        ByteSequence raw = ContentUtil.encode(s);
        RawField rawField = RawFieldParser.DEFAULT.parseField(raw);
        return ContentTransferEncodingFieldImpl.PARSER.parse(rawField, null);
    }
View Full Code Here

import org.apache.james.mime4j.util.ContentUtil;

public class MimeVersionParserTest extends TestCase {

    static MimeVersionField parse(final String s) throws MimeException {
        ByteSequence raw = ContentUtil.encode(s);
        RawField rawField = RawFieldParser.DEFAULT.parseField(raw);
        return MimeVersionFieldImpl.PARSER.parse(rawField, null);
    }
View Full Code Here

import junit.framework.TestCase;

public class ContentLanguageFieldTest extends TestCase {

    static ContentLanguageField parse(final String s) throws MimeException {
        ByteSequence raw = ContentUtil.encode(s);
        RawField rawField = RawFieldParser.DEFAULT.parseField(raw);
        return ContentLanguageFieldImpl.PARSER.parse(rawField, null);
    }
View Full Code Here

        assertEquals(0, mailboxes.size());
    }

    public void testParseGroup() throws Exception {
        String s = "group: john.doe@acme.org, Mary Smith <mary@example.net>";
        ByteSequence raw = ContentUtil.encode(s);
        ParserCursor cursor = new ParserCursor(0, s.length());
        Group group = parser.parseGroup(raw, cursor);
        assertEquals("group", group.getName());

        MailboxList mailboxes = group.getMailboxes();
View Full Code Here

        parser = LenientAddressBuilder.DEFAULT;
    }

    public void testParseDomain() throws Exception {
        String s = "machine (comment).  example (dot). com  ; more stuff";
        ByteSequence raw = ContentUtil.encode(s);
        ParserCursor cursor = new ParserCursor(0, s.length());

        String domain = parser.parseDomain(raw, cursor, RawFieldParser.INIT_BITSET(';'));
        assertEquals("machine.example.com", domain);
    }
View Full Code Here

TOP

Related Classes of org.apache.james.mime4j.util.ByteSequence

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.