Package java.io

Examples of java.io.Writer


  public void destroy() {
    // output api.txt for comparisons
    Collections.sort(api);
    try {
      File file = new File(basedir, checkOutputFile);
      Writer writer = new OutputStreamWriter(new FileOutputStream(file), "UTF-8");
      for (String line : api) {
        writer.write(line);
        writer.write('\n');
      }
      writer.close();
    } catch (IOException ioe) {
      log(0, "Cannot write target/api.txt, " + ioe.getMessage());
    }

    String problems = "";
View Full Code Here


        StringBuffer buffer = exportReportToBuffer();
        sb.append(buffer.toString());
      }
      else
      {
        Writer outWriter = (Writer)parameters.get(JRExporterParameter.OUTPUT_WRITER);
        if (outWriter != null)
        {
          try
          {
            exportReportToStream(outWriter);
View Full Code Here

    {
      rendererToImagePathMap = new HashMap();
      imageNameToImageDataMap = new HashMap();
    }
       
    Writer writer = null;
    try
    {
      OutputStream fileOutputStream = new FileOutputStream(destFile);
      writer = new BufferedWriter(new OutputStreamWriter(fileOutputStream, encoding));
      exportReportToStream(writer);
    }
    catch (IOException e)
    {
      throw new JRException("Error writing to file : " + destFile, e);
    }
    finally
    {
      if (writer != null)
      {
        try
        {
          writer.close();
        }
        catch(IOException e)
        {
        }
      }
View Full Code Here

   *
   */
  private void createMimeEntry(String mimetype) throws IOException
  {
    ExportZipEntry mimeEntry = createEntry("mimetype");
    Writer mimeWriter = null;
    try
    {
      mimeWriter = mimeEntry.getWriter();
      mimeWriter.write("application/vnd.oasis.opendocument." + mimetype);
      mimeWriter.flush();
      exportZipEntries.add(mimeEntry);
    }
    finally
    {
      if (mimeWriter != null)
      {
        try
        {
          mimeWriter.close();
        }
        catch (IOException e)
        {
        }
      }
View Full Code Here

   *
   */
  private void createManifestEntry(String mimetype) throws IOException
  {
    ExportZipEntry manifestEntry = createEntry("META-INF/manifest.xml");
    Writer manifestWriter = null;
    try
    {
      manifestWriter = manifestEntry.getWriter();
      manifestWriter.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
      manifestWriter.write("<!DOCTYPE manifest:manifest PUBLIC \"-//OpenOffice.org//DTD Manifest 1.0//EN\" \"Manifest.dtd\">\n");
      manifestWriter.write("<manifest:manifest xmlns:manifest=\"urn:oasis:names:tc:opendocument:xmlns:manifest:1.0\">\n");
      manifestWriter.write("  <manifest:file-entry manifest:media-type=\"application/vnd.oasis.opendocument." + mimetype + "\" manifest:full-path=\"/\"/>\n");
      manifestWriter.write("  <manifest:file-entry manifest:media-type=\"application/vnd.sun.xml.ui.configuration\" manifest:full-path=\"Configurations2/\"/>\n");
      manifestWriter.write("  <manifest:file-entry manifest:media-type=\"\" manifest:full-path=\"Pictures/\"/>\n");
      manifestWriter.write("  <manifest:file-entry manifest:media-type=\"text/xml\" manifest:full-path=\"content.xml\"/>\n");
      manifestWriter.write("  <manifest:file-entry manifest:media-type=\"text/xml\" manifest:full-path=\"styles.xml\"/>\n");
      manifestWriter.write("  <manifest:file-entry manifest:media-type=\"text/xml\" manifest:full-path=\"meta.xml\"/>\n");
      manifestWriter.write("  <manifest:file-entry manifest:media-type=\"\" manifest:full-path=\"Thumbnails/thumbnail.png\"/>\n");
      manifestWriter.write("  <manifest:file-entry manifest:media-type=\"\" manifest:full-path=\"Thumbnails/\"/>\n");
      manifestWriter.write("  <manifest:file-entry manifest:media-type=\"text/xml\" manifest:full-path=\"settings.xml\"/>\n");
      manifestWriter.write("</manifest:manifest>\n");
      manifestWriter.flush();
      exportZipEntries.add(manifestEntry);
    }
    finally
    {
      if (manifestWriter != null)
      {
        try
        {
          manifestWriter.close();
        }
        catch (IOException e)
        {
        }
      }
View Full Code Here

      Node nodeCopy = node.copy(true);
      nodeCopy.setParent(null);
      String filename = (Validations.isEmpty(nodeCopy.getId()) ? nodeCopy
          .getType() : nodeCopy.getId()) + ".xml";
      File dumpFile = new File(Files.createTempDirectory(), filename);
      Writer writer = Files.newWriter(dumpFile);
      toXML(nodeCopy, writer);
      writer.close();
      return Zipfiles.zip(dumpFile);
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
View Full Code Here

    if (node == null) {
      return null;
    }
    try {
      Blob blob = new Blob();
      Writer writer = Files.newWriter(blob.getFile());
      toXML(node, writer);
      writer.close();
      return blob;
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
View Full Code Here

    wbHelper.exportSheet(sheetIndex + 1, name);
    ctHelper.exportSheet(sheetIndex + 1);
    relsHelper.exportSheet(sheetIndex + 1);

    ExportZipEntry sheetRelsEntry = xlsxZip.addSheetRels(sheetIndex + 1);
    Writer sheetRelsWriter = sheetRelsEntry.getWriter();
    sheetRelsHelper = new XlsxSheetRelsHelper(sheetRelsWriter);

    ExportZipEntry sheetEntry = xlsxZip.addSheet(sheetIndex + 1);
    Writer sheetWriter = sheetEntry.getWriter();
    sheetHelper =
      new XlsxSheetHelper(
        sheetWriter,
        sheetRelsHelper,
        isCollapseRowSpan
        );
   
    ExportZipEntry drawingRelsEntry = xlsxZip.addDrawingRels(sheetIndex + 1);
    Writer drawingRelsWriter = drawingRelsEntry.getWriter();
    drawingRelsHelper = new XlsxDrawingRelsHelper(drawingRelsWriter);
   
    ExportZipEntry drawingEntry = xlsxZip.addDrawing(sheetIndex + 1);
    Writer drawingWriter = drawingEntry.getWriter();
    drawingHelper = new XlsxDrawingHelper(drawingWriter, drawingRelsHelper);
   
    cellHelper = new XlsxCellHelper(sheetWriter, styleHelper);
   
    runHelper = new XlsxRunHelper(sheetWriter, fontMap, null);//FIXMEXLSX check this null
View Full Code Here

       
        // See whether we need to use a custom response (if we're inside a TTM
        // or TDM or macro nested body, we'll need to as then the current
        // FM environment writer is not identical to HTTP servlet response
        // writer.
        final Writer envOut = env.getOut();
        final HttpServletResponse wrappedResponse;
        if(envOut == response.getWriter()) {
            // Don't bother wrapping if environment's writer is same as
            // response writer
            wrappedResponse = response;
View Full Code Here

        Document document = builder.build(System.in);
        SimpleHash model = new SimpleHash();
        model.put("document", new NodeListModel(document));
        FileReader fr = new FileReader(args[0]);
        Template template = new Template(args[0], fr);
        Writer w = new java.io.OutputStreamWriter(System.out);
        template.process(model, w);
        w.flush();
        w.close();
    }
View Full Code Here

TOP

Related Classes of java.io.Writer

Copyright © 2015 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.