Package com.alibaba.citrus.util.io

Examples of com.alibaba.citrus.util.io.ByteArrayInputStream

@author Michael Zhou

        @Override
        public void flush() throws IOException {
            ByteArray bytes = buffer.toByteArray();

            if (bytes.getLength() > 0) {
                ByteArrayInputStream inputBytes = new ByteArrayInputStream(bytes.getRawBytes(), bytes.getOffset(),
                        bytes.getLength());
                InputStreamReader reader = new InputStreamReader(inputBytes, charset);

                StreamUtil.io(reader, writer, true, false);
                writer.flush();
View Full Code Here


        @Override
        public void flush() throws IOException {
            ByteArray bytes = buffer.toByteArray();

            if (bytes.getLength() > 0) {
                ByteArrayInputStream inputBytes = new ByteArrayInputStream(bytes.getRawBytes(), bytes.getOffset(),
                                                                           bytes.getLength());
                InputStreamReader reader = new InputStreamReader(inputBytes, charset);

                StreamUtil.io(reader, writer, true, false);
                writer.flush();
View Full Code Here

        assertTrue(templateFile.exists(), templateFile.getAbsolutePath() + " not exist");

        String relativePath = FileUtil.normalizeAbsolutePath(templateFile.getAbsolutePath().substring(
                new File(srcdir, "templates").getCanonicalPath().length()));

        return new ByteArrayInputStream(relativePath.getBytes());
    }
View Full Code Here

        String s = "#@trimming on\n";
        s += "${abc: #abc}\n";
        s += "#abc(def.htm) ## xxxx";

        try {
            new Template(new ByteArrayInputStream(s.getBytes()), "test.txt");
            fail();
        } catch (TemplateParseException e) {
            // source.getRelative()返回null
            assertThat(e, exception("Could not import template file \"def.htm\" at ", "Line 3 Column 6"));
        }
View Full Code Here

        assertTemplate(template, null, nodesCount, templatesCount, paramsCount, null);
    }

    protected void loadTemplate(byte[] content, String systemId, int nodesCount, int templatesCount, int paramsCount) {
        source = systemId;
        template = new Template(new ByteArrayInputStream(content), systemId);

        assertTemplate(template, null, nodesCount, templatesCount, paramsCount, null);
    }
View Full Code Here

        transformer2 = new Transformer() {
            public void transform(Document document, String systemId) {
                document.getRootElement().addElement("hi");
            }
        };
        document = SchemaUtil.readDocument(new ByteArrayInputStream("<doc></doc>".getBytes()), "", true);

        schema = new SchemaBaseImpl(source);
    }
View Full Code Here

    public final InputStream getInputStream() {
        serialize();

        if (transformedData != null) {
            return new ByteArrayInputStream(transformedData);
        }

        if (originalSource != null) {
            return getOriginalInputStream();
        } else {
View Full Code Here

        @Override
        public void flush() throws IOException {
            ByteArray bytes = buffer.toByteArray();

            if (bytes.getLength() > 0) {
                ByteArrayInputStream inputBytes = new ByteArrayInputStream(bytes.getRawBytes(), bytes.getOffset(),
                                                                           bytes.getLength());
                InputStreamReader reader = new InputStreamReader(inputBytes, charset);

                StreamUtil.io(reader, writer, true, false);
                writer.flush();
View Full Code Here

                log.warn("Failed to decode field attachment: " + e);
                return null;
            }

            // 2. 解压缩
            ByteArrayInputStream bais = new ByteArrayInputStream(plaintext);
            Inflater inf = new Inflater(false);
            InflaterInputStream iis = new InflaterInputStream(bais, inf);

            // 3. 反序列化
            ObjectInputStream ois = null;
View Full Code Here

        @Override
        public void flush() throws IOException {
            ByteArray bytes = buffer.toByteArray();

            if (bytes.getLength() > 0) {
                ByteArrayInputStream inputBytes = new ByteArrayInputStream(bytes.getRawBytes(), bytes.getOffset(),
                                                                           bytes.getLength());
                InputStreamReader reader = new InputStreamReader(inputBytes, charset);

                StreamUtil.io(reader, writer, true, false);
                writer.flush();
View Full Code Here

TOP

Related Classes of com.alibaba.citrus.util.io.ByteArrayInputStream

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.