Package com.alibaba.citrus.util.io

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


            ((BufferedServletOutputStream) stream).updateOutputStream(bytesStack.peek());

            log.debug("Popped the last byte buffer (stack size is " + bytesStack.size() + ")");

            return block.toByteArray();
        }
    }

    /**
     * ���������buffer�������ջ��ֻ��һ��buffer���򵯳����ٴ���һ���µġ�
 
View Full Code Here


    @Test
    public void writeTo() throws Exception {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        builder.writeTo(baos, rawSession);

        String eml = save(new String(baos.toByteArray().toByteArray()));

        assertThat(eml, containsAllRegex( //
                "Subject:\\s*" + REGEX_EOL, //
                "Content-Type: text/plain; charset=us-ascii" + REGEX_EOL, //
                REGEX_EOL + REGEX_EOL + "$"));
View Full Code Here

            }

            def.end();
        }

        byte[] plaintext = baos.toByteArray().toByteArray();

        // 3. ����
        byte[] cryptotext = encrypt(plaintext);

        // 4. base64����
View Full Code Here

            unexpectedException(e);
        } finally {
            ostream.close();
        }

        ByteArray bytes = ostream.toByteArray();

        javaCharset = getJavaCharset(javaCharset);

        return new String(bytes.getRawBytes(), bytes.getOffset(), bytes.getLength(), javaCharset);
    }
View Full Code Here

            ((BufferedServletOutputStream) stream).updateOutputStream(bytesStack.peek());

            log.debug("Popped the last byte buffer (stack size is " + bytesStack.size() + ")");

            return block.toByteArray();
        }
    }

    /**
     * 弹出最近的buffer,如果堆栈中只有一个buffer,则弹出后再创建一个新的。
 
View Full Code Here

        // writeTo stream
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        templateService.writeTo(templateName, null, baos);

        assertEquals(result, new String(baos.toByteArray().toByteArray()));

        // writeTo writer
        StringWriter sw = new StringWriter();
        templateService.writeTo(templateName, null, sw);
View Full Code Here

    @Test
    public void writeTo() throws Exception {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        builder.writeTo(baos, rawSession);

        String eml = save(new String(baos.toByteArray().toByteArray()));

        assertThat(eml, containsAllRegex( //
                                          "Subject:\\s*" + REGEX_EOL, //
                                          "Content-Type: text/plain; charset=us-ascii" + REGEX_EOL, //
                                          REGEX_EOL + REGEX_EOL + "$"));
View Full Code Here

            ((BufferedServletOutputStream) stream).updateOutputStream(bytesStack.peek());

            log.debug("Popped the last byte buffer (stack size is " + bytesStack.size() + ")");

            return block.toByteArray();
        }
    }

    /**
     * 弹出最近的buffer,如果堆栈中只有一个buffer,则弹出后再创建一个新的。
 
View Full Code Here

            }

            def.end();
        }

        byte[] plaintext = baos.toByteArray().toByteArray();

        // 3. 加密
        byte[] cryptotext = encrypt(plaintext);

        // 4. base64编码
View Full Code Here

            unexpectedException(e);
        } finally {
            ostream.close();
        }

        ByteArray bytes = ostream.toByteArray();

        javaCharset = getJavaCharset(javaCharset);

        return new String(bytes.getRawBytes(), bytes.getOffset(), bytes.getLength(), javaCharset);
    }
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.