Package org.apache.james.mime4j.io

Examples of org.apache.james.mime4j.io.BufferedLineReaderInputStream


    public void testReadEmptyLine() throws Exception {

        String teststr = "\n\n\r\n\r\r\n\n\n\n\n\n";
        byte[] raw = teststr.getBytes("US-ASCII");

        LineReaderInputStream instream = new BufferedLineReaderInputStream(new ByteArrayInputStream(raw), 4);

        ByteArrayBuffer linebuf = new ByteArrayBuffer(8);
        linebuf.clear();
        instream.readLine(linebuf);
        String s = new String(linebuf.toByteArray(), "US-ASCII");
        assertEquals("\n", s);

        linebuf.clear();
        instream.readLine(linebuf);
        s = new String(linebuf.toByteArray(), "US-ASCII");
        assertEquals("\n", s);

        linebuf.clear();
        instream.readLine(linebuf);
        s = new String(linebuf.toByteArray(), "US-ASCII");
        assertEquals("\r\n", s);

        linebuf.clear();
        instream.readLine(linebuf);
        s = new String(linebuf.toByteArray(), "US-ASCII");
        assertEquals("\r\r\n", s);

        linebuf.clear();
        instream.readLine(linebuf);
        s = new String(linebuf.toByteArray(), "US-ASCII");
        assertEquals("\n", s);

        linebuf.clear();
        instream.readLine(linebuf);
        s = new String(linebuf.toByteArray(), "US-ASCII");
        assertEquals("\n", s);

        linebuf.clear();
        instream.readLine(linebuf);
        s = new String(linebuf.toByteArray(), "US-ASCII");
        assertEquals("\n", s);

        linebuf.clear();
        instream.readLine(linebuf);
        s = new String(linebuf.toByteArray(), "US-ASCII");
        assertEquals("\n", s);

        linebuf.clear();
        instream.readLine(linebuf);
        s = new String(linebuf.toByteArray(), "US-ASCII");
        assertEquals("\n", s);

        assertEquals(-1, instream.readLine(linebuf));
        assertEquals(-1, instream.readLine(linebuf));
    }
View Full Code Here


            "\r\n" +
            "a very important message";
        byte[] raw = message.getBytes("US-ASCII");
        ByteArrayInputStream instream = new ByteArrayInputStream(raw);
        LineNumberInputStream lineInput = new LineNumberInputStream(instream);
        BufferedLineReaderInputStream rawstream = new BufferedLineReaderInputStream(lineInput, 12);

        MimeEntity entity = new MimeEntity(
                lineInput,
                rawstream, new FallbackBodyDescriptorBuilder());
View Full Code Here

            "\r\n" +
            "a very important message";
        byte[] raw = message.getBytes("US-ASCII");
        ByteArrayInputStream instream = new ByteArrayInputStream(raw);
        LineNumberInputStream lineInput = new LineNumberInputStream(instream);
        BufferedLineReaderInputStream rawstream = new BufferedLineReaderInputStream(lineInput, 12);

        MimeEntity entity = new MimeEntity(
                lineInput,
                rawstream, new FallbackBodyDescriptorBuilder());
View Full Code Here

            "--1729--\r\n" +
            "Goodbye!";
        byte[] raw = message.getBytes("US-ASCII");
        ByteArrayInputStream instream = new ByteArrayInputStream(raw);
        LineNumberInputStream lineInput = new LineNumberInputStream(instream);
        BufferedLineReaderInputStream rawstream = new BufferedLineReaderInputStream(lineInput, 24);

        MimeEntity entity = new MimeEntity(
                lineInput,
                rawstream, new FallbackBodyDescriptorBuilder());
View Full Code Here

            "--1729--\r\n" +
            "Goodbye!";
        byte[] raw = message.getBytes("US-ASCII");
        ByteArrayInputStream instream = new ByteArrayInputStream(raw);
        LineNumberInputStream lineInput = new LineNumberInputStream(instream);
        BufferedLineReaderInputStream rawstream = new BufferedLineReaderInputStream(lineInput, 24);

        MimeEntity entity = new MimeEntity(
                lineInput,
                rawstream, new FallbackBodyDescriptorBuilder());
View Full Code Here

            "\r\n" +
            "a very important message";
        byte[] raw = message.getBytes("US-ASCII");
        ByteArrayInputStream instream = new ByteArrayInputStream(raw);
        LineNumberInputStream lineInput = new LineNumberInputStream(instream);
        BufferedLineReaderInputStream rawstream = new BufferedLineReaderInputStream(lineInput, 12, config.getMaxLineLen());

        MimeEntity entity = new MimeEntity(
                lineInput,
                rawstream,
                config,
View Full Code Here

            "\r\n" +
            "a very important message";
        byte[] raw = message.getBytes("US-ASCII");
        ByteArrayInputStream instream = new ByteArrayInputStream(raw);
        LineNumberInputStream lineInput = new LineNumberInputStream(instream);
        BufferedLineReaderInputStream rawstream = new BufferedLineReaderInputStream(lineInput, 12);

        MimeConfig config = new MimeConfig();
        config.setMaxLineLen(100);
        config.setMaxHeaderLen(200);
        MimeEntity entity = new MimeEntity(
View Full Code Here

    public void testReadEmptyLineMaxLimit() throws Exception {

        String teststr = "1234567890\r\n";
        byte[] raw = teststr.getBytes("US-ASCII");

        LineReaderInputStream instream1 = new BufferedLineReaderInputStream(
                new ByteArrayInputStream(raw), 1024, 13);
        ByteArrayBuffer linebuf = new ByteArrayBuffer(8);
        linebuf.clear();
        instream1.readLine(linebuf);

        LineReaderInputStream instream2 = new BufferedLineReaderInputStream(
                new ByteArrayInputStream(raw), 1024, 12);
        linebuf.clear();
        try {
            instream2.readLine(linebuf);
            fail("MaxLineLimitException should have been thrown");
        } catch (MaxLineLimitException ex) {
        }
    }
View Full Code Here

            "\r\n" +
            "a very important message";
        byte[] raw = message.getBytes("US-ASCII");
        ByteArrayInputStream instream = new ByteArrayInputStream(raw);
        LineNumberInputStream lineInput = new LineNumberInputStream(instream);
        BufferedLineReaderInputStream rawstream = new BufferedLineReaderInputStream(lineInput, 12, config.getMaxLineLen());

        MimeEntity entity = new MimeEntity(
                lineInput,
                rawstream,
                config,
View Full Code Here

            "\r\n" +
            "a very important message";
        byte[] raw = message.getBytes("US-ASCII");
        ByteArrayInputStream instream = new ByteArrayInputStream(raw);
        LineNumberInputStream lineInput = new LineNumberInputStream(instream);
        BufferedLineReaderInputStream rawstream = new BufferedLineReaderInputStream(lineInput, 12);

        MimeConfig config = new MimeConfig();
        config.setMaxHeaderCount(20);
        MimeEntity entity = new MimeEntity(
                lineInput,
View Full Code Here

TOP

Related Classes of org.apache.james.mime4j.io.BufferedLineReaderInputStream

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.