Examples of LineBreakingOutputStream


Examples of org.apache.james.mime4j.decoder.LineBreakingOutputStream

*/
public class LineBreakingOutputStreamTest extends TestCase {
   
    public void testLongLine() throws IOException {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        OutputStream os = new LineBreakingOutputStream(out, 4);
        os.write("gsdfklgsjdhflkgjhsdfklgjhsdlkfjghksdljfhgslkdjfhgklsjdhf".getBytes());
        os.flush();
        os.close();
        String expected = "gsdf\r\nklgs\r\njdhf\r\nlkgj\r\nhsdf\r\nklgj\r\nhsdl\r\nkfjg\r\nhksd\r\nljfh\r\ngslk\r\ndjfh\r\ngkls\r\njdhf";
        assertEquals(new String(out.toByteArray()), expected);
    }
View Full Code Here

Examples of org.apache.james.mime4j.decoder.LineBreakingOutputStream

    }
   
    public void testLineLengthEqualInput() throws IOException {
        String input = "gsdfklgsjdhflkgjhsdfklgjhsdlkfjghksdljfhgslkdjfhgklsjdhf";
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        OutputStream os = new LineBreakingOutputStream(out, input.length());
        os.write(input.getBytes());
        os.flush();
        os.close();
        assertEquals(new String(out.toByteArray()), input);
    }
View Full Code Here

Examples of org.apache.james.mime4j.decoder.LineBreakingOutputStream

    }
   
    public void testLineLengthLongerThanInput() throws IOException {
        String input = "gsdfklgsjdhflkgjhsdfklgjhsdlkfjghksdljfhgslkdjfhgklsjdhf";
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        OutputStream os = new LineBreakingOutputStream(out, input.length()+1);
        os.write(input.getBytes());
        os.flush();
        os.close();
        assertEquals(new String(out.toByteArray()), input);
    }
View Full Code Here

Examples of org.apache.james.mime4j.decoder.LineBreakingOutputStream

   
    public void testLineLengthShorterThanInput() throws IOException {
        String input = "gsdfklgsjdhflkgjhsdfklgjhsdlkfjghksdljfhgslkdjfhgklsjdhf";
        String expected = "gsdfklgsjdhflkgjhsdfklgjhsdlkfjghksdljfhgslkdjfhgklsjdh\r\nf";
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        OutputStream os = new LineBreakingOutputStream(out, input.length()-1);
        os.write(input.getBytes());
        os.flush();
        os.close();
        assertEquals(new String(out.toByteArray()), expected);
    }
View Full Code Here

Examples of org.apache.james.mime4j.decoder.LineBreakingOutputStream

   
    public void testZeroLengthInput() throws IOException {
        String input = "";
        String expected = "";
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        OutputStream os = new LineBreakingOutputStream(out, 10);
        os.write(input.getBytes());
        os.flush();
        os.close();
        assertEquals(new String(out.toByteArray()), expected);
    }
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.