Package org.apache.james.mime4j.io

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


        String text = "Line 1\r\nLine 2\r\n--boundary\r\n" +
                "Line 3\r\nLine 4\r\n--boundary--";
       
        ByteArrayInputStream bis = new ByteArrayInputStream(text.getBytes("US-ASCII"));
       
        BufferedLineReaderInputStream buffer = new BufferedLineReaderInputStream(bis, 4096);
       
        MimeBoundaryInputStream mime1 = new MimeBoundaryInputStream(buffer, "boundary");
        assertEquals("Line 1\r\nLine 2", read(mime1, 5));
       
        assertFalse(mime1.isLastPart());
View Full Code Here


        String text = "Line 1\r\nLine 2\n--boundary\n" +
                "Line 3\r\nLine 4\n--boundary--\n";
       
        ByteArrayInputStream bis = new ByteArrayInputStream(text.getBytes("US-ASCII"));
       
        BufferedLineReaderInputStream buffer = new BufferedLineReaderInputStream(bis, 4096);
       
        MimeBoundaryInputStream mime1 = new MimeBoundaryInputStream(buffer, "boundary");
        assertEquals("Line 1\r\nLine 2", read(mime1, 5));
       
        assertFalse(mime1.isLastPart());
View Full Code Here

        String text = "yadayadayadayadayadayadayadayadayadayadayadayadayadayadayadayada\r\n--boundary\r\n" +
                "blahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblah\r\n--boundary--";
       
        ByteArrayInputStream bis = new ByteArrayInputStream(text.getBytes("US-ASCII"));
       
        BufferedLineReaderInputStream buffer = new BufferedLineReaderInputStream(bis, 20);
       
        MimeBoundaryInputStream mime1 = new MimeBoundaryInputStream(buffer, "boundary");
        assertEquals("yadayadayadayadayadayadayadayadayadayadayadayadayadayadayadayada",
                read(mime1, 10));
       
View Full Code Here

        String text = "yadayadayadayadayadayadayadayadayadayadayadayadayadayadayadayada\r\n--boundary\r\n" +
                "blahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblah\r\n--boundary--";
       
        ByteArrayInputStream bis = new ByteArrayInputStream(text.getBytes("US-ASCII"));
       
        BufferedLineReaderInputStream buffer = new BufferedLineReaderInputStream(bis, 20);
       
        MimeBoundaryInputStream mime1 = new MimeBoundaryInputStream(buffer, "boundary");
       
        assertEquals("yadayadayadayadayadayadayadayadayadayadayadayadayadayadayadayada",
                read(mime1, 25));
View Full Code Here

        String text = "Line 1\r\nLine 2\r\n--boundary\r\n" +
                "Line 3\r\nLine 4\r\n--boundary--";
       
        ByteArrayInputStream bis = new ByteArrayInputStream(text.getBytes("US-ASCII"));
       
        BufferedLineReaderInputStream buffer = new BufferedLineReaderInputStream(bis, 4096);
       
        MimeBoundaryInputStream mime1 = new MimeBoundaryInputStream(buffer, "boundary");
        assertEquals("Line 1\r\nLine 2", readByOneByte(mime1));
       
        assertFalse(mime1.isLastPart());
View Full Code Here

        String text = "Line 1\r\nLine 2\r\n--boundary\r\n" +
                "Line 3\r\nLine 4\r\n\r\n--boundary\r\n";
       
        ByteArrayInputStream bis = new ByteArrayInputStream(text.getBytes("US-ASCII"));
       
        BufferedLineReaderInputStream buffer = new BufferedLineReaderInputStream(bis, 4096);
       
        MimeBoundaryInputStream mime1 = new MimeBoundaryInputStream(buffer, "boundary");
        assertEquals("Line 1\r\nLine 2", read(mime1, 5));
       
        assertFalse(mime1.isLastPart());
View Full Code Here

     */
    public void testImmediateBoundary() throws IOException {
        String text = "--boundary\r\n";
       
        ByteArrayInputStream bis = new ByteArrayInputStream(text.getBytes());
        BufferedLineReaderInputStream buffer = new BufferedLineReaderInputStream(bis, 4096);
       
        MimeBoundaryInputStream stream =
            new MimeBoundaryInputStream(buffer, "boundary");
        assertEquals(-1, stream.read());
       
        text = "\r\n--boundary\r\n";
       
        bis = new ByteArrayInputStream(text.getBytes());
        buffer = new BufferedLineReaderInputStream(bis, 4096);
        stream =
            new MimeBoundaryInputStream(buffer, "boundary");
        assertEquals(-1, stream.read());
    }
View Full Code Here

     */
    public void testHasMoreParts() throws IOException {
        String text = "--boundary--\r\n";
       
        ByteArrayInputStream bis = new ByteArrayInputStream(text.getBytes());
        BufferedLineReaderInputStream buffer = new BufferedLineReaderInputStream(bis, 4096);
        MimeBoundaryInputStream stream =
            new MimeBoundaryInputStream(buffer, "boundary");
        assertEquals(-1, stream.read());
        assertTrue(stream.isLastPart());
    }
View Full Code Here

     */
    public void testPrefixIsBoundary() throws IOException {
        String text = "Line 1\r\n\r\n--boundaryyada\r\n";
       
        ByteArrayInputStream bis = new ByteArrayInputStream(text.getBytes());
        BufferedLineReaderInputStream buffer = new BufferedLineReaderInputStream(bis, 4096);
        MimeBoundaryInputStream stream =
            new MimeBoundaryInputStream(buffer, "boundary");
        assertEquals("Line 1\r\n", read(stream, 100));
       
        text = "--boundaryyada\r\n";
       
        bis = new ByteArrayInputStream(text.getBytes());
        buffer = new BufferedLineReaderInputStream(bis, 4096);
        stream = new MimeBoundaryInputStream(buffer, "boundary");
        assertEquals(-1, stream.read());
    }
View Full Code Here

            outstream.write(teststrs[i].getBytes("US-ASCII"));
        }
        outstream.write(term.getBytes("US-ASCII"));
        byte[] raw = outstream.toByteArray();
       
        BufferedLineReaderInputStream inbuffer = new BufferedLineReaderInputStream(new ByteArrayInputStream(raw), 20);
        LineReaderInputStream instream = new MimeBoundaryInputStream(inbuffer, "1234");
       
        ByteArrayBuffer linebuf = new ByteArrayBuffer(8);
        for (int i = 0; i < teststrs.length; i++) {
            linebuf.clear();
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.