Package java.io

Examples of java.io.Writer


   
    private static Writer getStreamByName(String streamName) {
        if ((streamName != null) && streamName.equals(DEFAULT_STREAM)) {
            // As long as the stream has not been nulled, assign the default if not found
            synchronized (semaphore) {
                Writer stream = (Writer) namedStreams.get(streamName);
                if ((stream == null) && !namedStreams.containsKey(streamName)) {
                    stream = defaultStream;
                }
                return stream;
            }
View Full Code Here


       
        if (!initialised) {
            init(INFO);
        }
       
        Writer stream = getStreamByName(streamName);
        if (stream != null) {
            Writer fullMessage = new StringWriter();
            String date = null;
            synchronized (sdfLog) {
                date = sdfLog.format(new Date());
            }
            try {
                fullMessage.write("[");
                fullMessage.write(streamName);
                fullMessage.write(" ");
                fullMessage.write(date);
                fullMessage.write("] - ");
                if (showThrowingThread) {
                    fullMessage.write("[");
                    fullMessage.write(Thread.currentThread().getName());
                    fullMessage.write("] - ");
                }
                fullMessage.write(message);
                if (error != null) {
                    fullMessage.write(LINE_SEPARATOR);
                    PrintWriter pw = new PrintWriter(fullMessage);
                    error.printStackTrace(pw);
                    pw.flush();
                }
                fullMessage.write(LINE_SEPARATOR);
               
                stream.write(fullMessage.toString());
                stream.flush();
            } catch (IOException err) {
                System.err.println(Launcher.RESOURCES.getString("Logger.StreamWriteError", message));
                err.printStackTrace(System.err);
            }
View Full Code Here

        String output = Launcher.RESOURCES.getString("WinstoneResponse.ErrorPage",
                new String[] { sc + "", (msg == null ? "" : msg), sw.toString(),
                Launcher.RESOURCES.getString("ServerVersion"),
                        "" + new Date() });
        response.setContentLength(output.getBytes(response.getCharacterEncoding()).length);
        Writer out = response.getWriter();
        out.write(output);
        out.flush();
    }
View Full Code Here

        ((Schema)extElement).setElement(targetElement);
        types.addExtensibilityElement(extElement);
        this.wsdlDefinition.setTypes(types);

        WSDLWriter wsdlWriter = wsdlFactory.newWSDLWriter();
        Writer outputWriter = getOutputWriter();

        try {
            wsdlWriter.writeWSDL(wsdlDefinition, outputWriter);
        } catch (WSDLException wse) {
            Message msg = new Message("FAIL_TO_WRITE_WSDL", LOG);
            throw new ToolException(msg, wse);
        }
        try {
            outputWriter.close();
        } catch (IOException ioe) {
            Message msg = new Message("FAIL_TO_CLOSE_WSDL_FILE", LOG);
            throw new ToolException(msg, ioe);
        }
    }
View Full Code Here

        registry.registerDeserializer(clz, ToolConstants.JAXWS_BINDINGS, new JAXWSBindingDeserializer());
        registry.mapExtensionTypes(clz, ToolConstants.JAXWS_BINDINGS, JAXWSBinding.class);
    }
   
    private Writer getOutputWriter() throws ToolException {
        Writer writer = null;
        String newName = null;
        String outputDir;

        if (env.get(ToolConstants.CFG_OUTPUTFILE) != null) {
            newName = (String)env.get(ToolConstants.CFG_OUTPUTFILE);
View Full Code Here

    private final Map<String, AbstractGenerator> generators = new HashMap<String, AbstractGenerator>();
    private List<Definition> importedDefinitions = new ArrayList<Definition>();
    private List<String> schemaTargetNamespaces = new ArrayList<String>();

    protected Writer getOutputWriter(String newNameExt) throws ToolException {
        Writer writer = null;
        String newName = null;
        String outputDir;

        if (env.get(ToolConstants.CFG_OUTPUTFILE) != null) {
            newName = (String)env.get(ToolConstants.CFG_OUTPUTFILE);
View Full Code Here

        setSoapBindingExtElement();
        addBindingOperation();
        wsdlDefinition.addBinding(binding);

        WSDLWriter wsdlWriter = wsdlFactory.newWSDLWriter();
        Writer outputWriter = getOutputWriter(NEW_FILE_NAME_MODIFIER);
        try {
            wsdlWriter.writeWSDL(wsdlDefinition, outputWriter);
        } catch (WSDLException wse) {
            Message msg = new Message("FAIL_TO_WRITE_WSDL", LOG);
            throw new ToolException(msg);

        }
        try {
            outputWriter.close();
        } catch (IOException ioe) {
            Message msg = new Message("PORTTYPE_NOT_EXIST", LOG);
            throw new ToolException(msg);
        }
    }
View Full Code Here

        return fw.isCollision(packageName, filename + ext);
    }

    protected Writer parseOutputName(String packageName, String filename, String ext) throws ToolException {
        FileWriterUtil fw = null;
        Writer writer = null;

        fw = new FileWriterUtil((String)env.get(ToolConstants.CFG_OUTPUTDIR));
        try {
            writer = fw.getWriter(packageName, filename + ext);
        } catch (IOException ioe) {
View Full Code Here

        setAddrElement();
        service.addPort(port);
        wsdlDefinition.addService(service);

        WSDLWriter wsdlWriter = wsdlFactory.newWSDLWriter();
        Writer outputWriter = getOutputWriter(NEW_FILE_NAME_MODIFIER);
        try {
            wsdlWriter.writeWSDL(wsdlDefinition, outputWriter);
        } catch (WSDLException wse) {
            Message msg = new Message("FAIl_TO_WRITE_WSDL", LOG);
            throw new ToolException(msg, wse);
        }
        try {
            outputWriter.close();
        } catch (IOException ioe) {
            Message msg = new Message("FAIL_TO_CLOSE_WSDL_FILE", LOG);
            throw new ToolException(msg, ioe);
        }
View Full Code Here

        port.addExtensibilityElement(xmlHttpAddress);
    }

    private void writeToWSDL() throws ToolException {
        WSDLWriter wsdlWriter = wsdlFactory.newWSDLWriter();
        Writer outputWriter = getOutputWriter(NEW_FILE_NAME_MODIFIER);
        try {
            wsdlWriter.writeWSDL(wsdlDefinition, outputWriter);
        } catch (WSDLException wse) {
            Message msg = new Message("FAIL_TO_WRITE_WSDL", LOG);
            throw new ToolException(msg);
        }
        try {
            outputWriter.close();
        } catch (IOException ioe) {
            Message msg = new Message("FAIL_TO_CLOSE_WSDL_FILE", LOG);
            throw new ToolException(msg);
        }
    }
View Full Code Here

TOP

Related Classes of java.io.Writer

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.