Package org.apache.commons.io.output

Examples of org.apache.commons.io.output.CountingOutputStream


            if(null != templateRegex) builder.setTemplateRegex(templateRegex);
            if(null != templateValueConstraintRegex) builder.setTemplateValueConstraintRegex(templateValueConstraintRegex);
            if(null != typeIdMapJson) builder.setTypeIdMap(parseTypeIdMap(typeIdMapJson));
            if(null != templateFile) builder.setFreemarkerTemplate(FileUtils.readFileToString(templateFile, templateFileEncoding));
            CodeGenerator cg = builder.build();
            CountingOutputStream counter = new CountingOutputStream(openOutputStream(outFile));
            outWriter = new OutputStreamWriter(counter, "UTF-8");
            getLog().info("Generating queries wrapper for file: [" + queriesFile.getAbsolutePath() + "] " +
                    "into java file: [" + outFile.getAbsolutePath() + "]");
            cg.generate(queries, fcn, queriesFile.getName(), outWriter);
            getLog().info("Writing compete, bytes written: [" + counter.getCount() + "]");
        } catch(IOException e) {
            throw new MojoFailureException("IO error", e);
        } catch (ClassNotFoundException e) {
            throw new MojoFailureException("Type id map error", e);
        } finally {
View Full Code Here


            if(null != selectRegex) builder.setSelectRegex(selectRegex);
            if(null != updateRegex) builder.setUpdateRegex(updateRegex);
            if(null != typeIdMapJson) builder.setTypeIdMap(parseTypeIdMap(typeIdMapJson));
            if(null != templateFile) builder.setFreemarkerTemplate(FileUtils.readFileToString(templateFile, templateFileEncoding));
            CodeGenerator cg = builder.build();
            CountingOutputStream counter = new CountingOutputStream(openOutputStream(outFile));
            outWriter = new OutputStreamWriter(counter, "UTF-8");
            getLog().info("Generating queries wrapper for file: [" + queriesFile.getAbsolutePath() + "] " +
                    "into java file: [" + outFile.getAbsolutePath() + "]");
            cg.generate(queries, fcn, queriesFile.getName(), outWriter);
            getLog().info("Writing compete, bytes written: [" + counter.getCount() + "]");
        } catch(IOException e) {
            throw new MojoFailureException("IO error", e);
        } catch (ClassNotFoundException e) {
            throw new MojoFailureException("Type id map error", e);
        } finally {
View Full Code Here

            if(null != templateRegex) builder.setTemplateRegex(templateRegex);
            if(null != templateValueConstraintRegex) builder.setTemplateValueConstraintRegex(templateValueConstraintRegex);
            if(null != typeIdMapJson) builder.setTypeIdMap(parseTypeIdMap(typeIdMapJson));
            if(null != templateFile) builder.setFreemarkerTemplate(FileUtils.readFileToString(templateFile, templateFileEncoding));
            CodeGenerator cg = builder.build();
            CountingOutputStream counter = new CountingOutputStream(openOutputStream(outFile));
            outWriter = new OutputStreamWriter(counter, "UTF-8");
            getLog().info("Generating queries wrapper for file: [" + queriesFile.getAbsolutePath() + "] " +
                    "into java file: [" + outFile.getAbsolutePath() + "]");
            cg.generate(queries, fcn, queriesFile.getName(), outWriter);
            getLog().info("Writing compete, bytes written: [" + counter.getCount() + "]");
        } catch(IOException e) {
            throw new MojoFailureException("IO error", e);
        } catch (ClassNotFoundException e) {
            throw new MojoFailureException("Type id map error", e);
        } finally {
View Full Code Here

        out.write(buf);
        bytesWritten += buf.length;
       
        //Stream contents
        CloseBlockerOutputStream cbout = new CloseBlockerOutputStream(out);
        CountingOutputStream cout = new CountingOutputStream(cbout);
        OutputStream filteredOutput =
                getFilterList().applyFilters(cout);
        outputRawStreamData(filteredOutput);
        filteredOutput.close();
        refLength.setNumber(new Integer(cout.getCount()));
        bytesWritten += cout.getCount();
           
        //Stream trailer
        buf = encode("\nendstream");
        out.write(buf);
        bytesWritten += buf.length;
View Full Code Here

    private void populateResponseFile(FileObject responseFile, MessageContext msgContext, boolean append) throws AxisFault {
        MessageFormatter messageFormatter = BaseUtils.getMessageFormatter(msgContext);
        OMOutputFormat format = BaseUtils.getOMOutputFormat(msgContext);
        try {
            CountingOutputStream os = new CountingOutputStream(responseFile.getContent().getOutputStream(append));
            try {
                messageFormatter.writeTo(msgContext, format, os, true);
            } finally {
                os.close();
            }
            // update metrics
            metrics.incrementMessagesSent();
            metrics.incrementBytesSent(os.getByteCount());
        } catch (FileSystemException e) {
            metrics.incrementFaultsSending();
            handleException("IO Error while creating response file : " + responseFile.getName(), e);
        } catch (IOException e) {
            metrics.incrementFaultsSending();
View Full Code Here

TOP

Related Classes of org.apache.commons.io.output.CountingOutputStream

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.