Package java.io

Examples of java.io.OutputStreamWriter


          if (rout != null)
            throw new IllegalStateException(
                "Already was returned as servlet output stream");
          String encoding = getCharacterEncoding();
          if (encoding != null)
            pw = new PrintWriter(new OutputStreamWriter(out,
                encoding));
          else
            pw = new PrintWriter(out);
        }
      }
View Full Code Here


        URL deviceURL = configuration.getDeviceURL(INSERT_TIMER_PAGE);
        URLConnection connection = deviceURL.openConnection();
        connection.setConnectTimeout(configuration.getConnectionTimeout());
        connection.setDoOutput(true);
        OutputStreamWriter connectionWriter = new OutputStreamWriter(connection.getOutputStream());
        connectionWriter.write(request);
        connectionWriter.close();
        InputStream contentStream = connection.getInputStream();
        BufferedReader in = new BufferedReader(new InputStreamReader(contentStream));
        boolean insertOK = true;
        String line;
        while ((line = in.readLine()) != null) {
View Full Code Here

    try {
      URL deviceURL = configuration.getDeviceURL(DELETE_TIMER_PAGE);
      URLConnection connection = deviceURL.openConnection();
      connection.setConnectTimeout(configuration.getConnectionTimeout());
      connection.setDoOutput(true);
      OutputStreamWriter connectionWriter = new OutputStreamWriter(connection.getOutputStream());
      connectionWriter.write(request);
      connectionWriter.close();
      // No need to check the answer, it's always OK. Nevertheless we have to
      // read the result or the server on the device won't answer the next
      // request.
      InputStream contentStream = connection.getInputStream();
      BufferedReader in = new BufferedReader(new InputStreamReader(contentStream));
View Full Code Here

            OutputStream outS = Channels.newOutputStream(out);
           
            if (stylesheet != null) {
              outS.write(("<?xml-stylesheet type=\"text/xsl\" href=\""+stylesheet+"\"?>\n").getBytes("utf-8"));
            }
            Writer outW = new OutputStreamWriter(outS, "utf-8");
            new Serializer().serialize(model, "", outW);
            outW.flush();
            //model.write(outS);
            outS.close();
          }
         
        });
View Full Code Here

   * @param extraSpace
   * @throws IOException
   */
  public XmpWriter(OutputStream os, String utfEncoding, int extraSpace) throws IOException {
    this.extraSpace = extraSpace;
    writer = new OutputStreamWriter(os, utfEncoding);
    writer.write("<?xpacket begin=\"\uFEFF\" id=\"W5M0MpCehiHzreSzNTczkc9d\"?>\n");
    writer.write("<x:xmpmeta xmlns:x=\"adobe:ns:meta/\">\n");
    writer.write("<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n");
    about = "";
  }
View Full Code Here

 

  public NTFileGraph(File file)
      throws IOException {
    super(ReificationStyle.Standard);
    fileWriter = new PrintWriter(new OutputStreamWriter(new FileOutputStream(file, true), "ascii"));
    if (file.exists()) {
      Model model = ModelFactory.createModelForGraph(this);
      new NonSkoNTripleReader().read(model, file.toURL().toString());
   
    created = true;
View Full Code Here

      freemarker.template.Configuration cfg = new freemarker.template.Configuration();
      cfg.setObjectWrapper(new DefaultObjectWrapper());
      cfg.setTemplateUpdateDelay(0);
      Template temp = new Template(name, new InputStreamReader(src), cfg);
      final ByteArrayOutputStream bout = new ByteArrayOutputStream();
      Writer out = new OutputStreamWriter(bout);
      temp.process(renderContext, out);
      out.flush();
      merged = new DataHandler(new DataSource() {
        public InputStream getInputStream() throws IOException {
          return new ByteArrayInputStream(bout.toByteArray());
        }
        public OutputStream getOutputStream() throws IOException {
View Full Code Here

     * whatever the encoding
     * @throws IOException on error
     */   
    public static void exportToXML(List list, OutputStream out, String encoding, boolean onlyASCII) throws IOException {
        String jenc = IanaEncodings.getJavaEncoding(encoding);
        Writer wrt = new BufferedWriter(new OutputStreamWriter(out, jenc));
        exportToXML(list, wrt, encoding, onlyASCII);
    }
View Full Code Here

        String init2 = getBaseDir() + "/test-init-2.sql";

        // Create two scripts that we will run via "INIT"
        IOUtils.createDirs(init1);

        Writer w = new OutputStreamWriter(IOUtils.openFileOutputStream(init1, false));

        PrintWriter writer = new PrintWriter(w);
        writer.println("create table test(id int identity, name varchar);");
        writer.println("insert into test(name) values('cat');");
        writer.close();

        w = new OutputStreamWriter(IOUtils.openFileOutputStream(init2, false));
        writer = new PrintWriter(w);
        writer.println("insert into test(name) values('dog');");
        writer.close();

        // Make the database connection, and run the two scripts
View Full Code Here

   * Returns a new writer instance that is backed by the shared output stream.
   * Closing a writer will prevent further writes.
   * @return
   */
  public Writer getWriter() {
    return new OutputStreamWriter(getOuputStream(), Charset.forName(encoding));
  }
View Full Code Here

TOP

Related Classes of java.io.OutputStreamWriter

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.