Examples of fillBuffer()


Examples of org.apache.james.mime4j.io.BufferedLineReaderInputStream.fillBuffer()

        String text = "blabla d is the word";
        String pattern = "d";
        byte[] b1 = text.getBytes("US-ASCII");
        byte[] b2 = pattern.getBytes("US-ASCII");
        BufferedLineReaderInputStream inbuffer = new BufferedLineReaderInputStream(new ByteArrayInputStream(b1), 4096);
        inbuffer.fillBuffer();
        int i = inbuffer.indexOf(b2);
        assertEquals(7, i);
    }
   
    public void testPatternMatching2() throws Exception {
View Full Code Here

Examples of org.apache.james.mime4j.io.BufferedLineReaderInputStream.fillBuffer()

        String text = "disddisdissdsidsidsiid";
        String pattern = "siid";
        byte[] b1 = text.getBytes("US-ASCII");
        byte[] b2 = pattern.getBytes("US-ASCII");
        BufferedLineReaderInputStream inbuffer = new BufferedLineReaderInputStream(new ByteArrayInputStream(b1), 4096);
        inbuffer.fillBuffer();
        int i = inbuffer.indexOf(b2);
        assertEquals(18, i);
    }
   
    public void testPatternMatching3() throws Exception {
View Full Code Here

Examples of org.apache.james.mime4j.io.BufferedLineReaderInputStream.fillBuffer()

        String text = "bla bla yada yada haha haha";
        String pattern = "blah";
        byte[] b1 = text.getBytes("US-ASCII");
        byte[] b2 = pattern.getBytes("US-ASCII");
        BufferedLineReaderInputStream inbuffer = new BufferedLineReaderInputStream(new ByteArrayInputStream(b1), 4096);
        inbuffer.fillBuffer();
        int i = inbuffer.indexOf(b2);
        assertEquals(-1, i);
    }
   
    public void testPatternMatching4() throws Exception {
View Full Code Here

Examples of org.apache.james.mime4j.io.BufferedLineReaderInputStream.fillBuffer()

        String text = "bla bla yada yada haha haha";
        String pattern = "bla";
        byte[] b1 = text.getBytes("US-ASCII");
        byte[] b2 = pattern.getBytes("US-ASCII");
        BufferedLineReaderInputStream inbuffer = new BufferedLineReaderInputStream(new ByteArrayInputStream(b1), 4096);
        inbuffer.fillBuffer();
        int i = inbuffer.indexOf(b2);
        assertEquals(0, i);
    }

    public void testPatternOutOfBound() throws Exception {
View Full Code Here

Examples of org.apache.james.mime4j.io.BufferedLineReaderInputStream.fillBuffer()

        String text = "bla bla yada yada haha haha";
        String pattern1 = "bla bla";
        byte[] b1 = text.getBytes("US-ASCII");
        byte[] b2 = pattern1.getBytes("US-ASCII");
        BufferedLineReaderInputStream inbuffer = new BufferedLineReaderInputStream(new ByteArrayInputStream(b1), 4096);
        inbuffer.fillBuffer();
        byte[] tmp = new byte[3];
        inbuffer.read(tmp);
        int i = inbuffer.indexOf(b2, inbuffer.pos(), inbuffer.length());
        assertEquals(-1, i);
        i = inbuffer.indexOf(b2, inbuffer.pos(), inbuffer.length() - 1);
View Full Code Here

Examples of org.apache.james.mime4j.io.BufferedLineReaderInputStream.fillBuffer()

    public void testCharOutOfBound() throws Exception {
        String text = "zzz blah blah blah ggg";
        byte[] b1 = text.getBytes("US-ASCII");
        BufferedLineReaderInputStream inbuffer = new BufferedLineReaderInputStream(new ByteArrayInputStream(b1), 4096);
        inbuffer.fillBuffer();
        byte[] tmp = new byte[3];
        inbuffer.read(tmp);
        int i = inbuffer.indexOf((byte)'z', inbuffer.pos(), inbuffer.length());
        assertEquals(-1, i);
        i = inbuffer.indexOf((byte)'g', inbuffer.pos(), inbuffer.length() - 3);
View Full Code Here

Examples of org.apache.james.mime4j.io.BufferedLineReaderInputStream.fillBuffer()

        String text = "blah blah yada yada";
        byte[] b1 = text.getBytes("US-ASCII");
        String pattern = "blah";
        byte[] b2 = pattern.getBytes("US-ASCII");
        BufferedLineReaderInputStream inbuffer = new BufferedLineReaderInputStream(new ByteArrayInputStream(b1), 4096);
        inbuffer.fillBuffer();
       
        assertEquals('b', inbuffer.read());
        assertEquals('l', inbuffer.read());
       
        try {
View Full Code Here

Examples of org.apache.james.mime4j.io.BufferedLineReaderInputStream.fillBuffer()

     
    public void testBasicOperations() throws Exception {
        String text = "bla bla yada yada haha haha";
        byte[] b1 = text.getBytes("US-ASCII");
        BufferedLineReaderInputStream inbuffer = new BufferedLineReaderInputStream(new ByteArrayInputStream(b1), 4096);
        inbuffer.fillBuffer();
        assertEquals(0, inbuffer.pos());
        assertEquals(27, inbuffer.limit());
        assertEquals(27, inbuffer.length());

        inbuffer.read();
View Full Code Here

Examples of org.apache.james.mime4j.io.BufferedLineReaderInputStream.fillBuffer()

        String text = "blabla d is the word";
        String pattern = "d";
        byte[] b1 = text.getBytes("US-ASCII");
        byte[] b2 = pattern.getBytes("US-ASCII");
        BufferedLineReaderInputStream inbuffer = new BufferedLineReaderInputStream(new ByteArrayInputStream(b1), 4096);
        inbuffer.fillBuffer();
        int i = inbuffer.indexOf(b2);
        assertEquals(7, i);
    }
   
    public void testPatternMatching2() throws Exception {
View Full Code Here

Examples of org.apache.james.mime4j.io.BufferedLineReaderInputStream.fillBuffer()

        String text = "disddisdissdsidsidsiid";
        String pattern = "siid";
        byte[] b1 = text.getBytes("US-ASCII");
        byte[] b2 = pattern.getBytes("US-ASCII");
        BufferedLineReaderInputStream inbuffer = new BufferedLineReaderInputStream(new ByteArrayInputStream(b1), 4096);
        inbuffer.fillBuffer();
        int i = inbuffer.indexOf(b2);
        assertEquals(18, i);
    }
   
    public void testPatternMatching3() throws Exception {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.