Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;

import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.TransformerFactoryConfigurationError;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;

public class Main {
    public static void getWordDocument1(ByteArrayOutputStream recvstram, String filename, String xslfilename)
            throws TransformerConfigurationException, TransformerException, TransformerFactoryConfigurationError {

        try {

            byte[] myBytes = recvstram.toByteArray();
            FileOutputStream out = new FileOutputStream("g:/input.txt");
            try {
                out.write(myBytes);
            } finally {
                out.close();
            }
            (TransformerFactory.newInstance().newTransformer(new StreamSource(new File("g:/" + xslfilename))))
                    .transform(new StreamSource(new File("g:/input.txt")),
                            new StreamResult(new File("g:/channel.doc")));

        } catch (Exception e) {

        }

    }
}