Package com.alibaba.citrus.util.io

Examples of com.alibaba.citrus.util.io.ByteArray.toByteArray()


        ostream.write("abc".getBytes());
        ostream.flush();

        ByteArray bytes = requestContext.popByteBuffer();

        assertEquals("abc", new String(bytes.toByteArray()));

        // write, push, write, push, write, pop, pop, pop
        ostream.write("abc".getBytes());
        ostream.flush();
View Full Code Here


        requestContext.pushBuffer();
        ostream.write("ghi".getBytes());
        ostream.flush();

        bytes = requestContext.popByteBuffer();
        assertEquals("ghi", new String(bytes.toByteArray()));

        bytes = requestContext.popByteBuffer();
        assertEquals("def", new String(bytes.toByteArray()));

        bytes = requestContext.popByteBuffer();
View Full Code Here

        bytes = requestContext.popByteBuffer();
        assertEquals("ghi", new String(bytes.toByteArray()));

        bytes = requestContext.popByteBuffer();
        assertEquals("def", new String(bytes.toByteArray()));

        bytes = requestContext.popByteBuffer();
        assertEquals("abc", new String(bytes.toByteArray()));
    }
View Full Code Here

        bytes = requestContext.popByteBuffer();
        assertEquals("def", new String(bytes.toByteArray()));

        bytes = requestContext.popByteBuffer();
        assertEquals("abc", new String(bytes.toByteArray()));
    }

    @Test
    public void charBuffer() throws Exception {
        PrintWriter writer = newResponse.getWriter();
View Full Code Here

        writer.write("abc");
        writer.flush();

        ByteArray bytes = requestContext.popByteBuffer();

        assertEquals("abc", new String(bytes.toByteArray()));

        // write, push, write, push, write, pop, pop, pop
        writer.write("abc");
        writer.flush();
View Full Code Here

        requestContext.pushBuffer();
        writer.write("ghi");
        writer.flush();

        bytes = requestContext.popByteBuffer();
        assertEquals("ghi", new String(bytes.toByteArray()));

        bytes = requestContext.popByteBuffer();
        assertEquals("def", new String(bytes.toByteArray()));

        bytes = requestContext.popByteBuffer();
View Full Code Here

        bytes = requestContext.popByteBuffer();
        assertEquals("ghi", new String(bytes.toByteArray()));

        bytes = requestContext.popByteBuffer();
        assertEquals("def", new String(bytes.toByteArray()));

        bytes = requestContext.popByteBuffer();
        assertEquals("abc", new String(bytes.toByteArray()));
    }
View Full Code Here

        bytes = requestContext.popByteBuffer();
        assertEquals("def", new String(bytes.toByteArray()));

        bytes = requestContext.popByteBuffer();
        assertEquals("abc", new String(bytes.toByteArray()));
    }

    @Test
    public void illegalStateExceptionForBytes() throws Exception {
        // getOutputStream֮����ͼpopCharBuffer
View Full Code Here

        ostream.write("abc".getBytes());
        ostream.flush();

        ByteArray bytes = requestContext.popByteBuffer();

        assertEquals("abc", new String(bytes.toByteArray()));

        // write, push, write, push, write, pop, pop, pop
        ostream.write("abc".getBytes());
        ostream.flush();
View Full Code Here

        requestContext.pushBuffer();
        ostream.write("ghi".getBytes());
        ostream.flush();

        bytes = requestContext.popByteBuffer();
        assertEquals("ghi", new String(bytes.toByteArray()));

        bytes = requestContext.popByteBuffer();
        assertEquals("def", new String(bytes.toByteArray()));

        bytes = requestContext.popByteBuffer();
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.