Package java.io

Examples of java.io.FileWriter


    }
   
    ImageIO.write(bi,resources.getString("imageFileExtension"),_imageFile);
    _htmlFile = new File(resources.getString("htmlFileName")).getCanonicalFile();

    FileWriter writeFile= new FileWriter(_htmlFile);
    BufferedWriter writeBuf = new BufferedWriter(writeFile)
    HTMLWriter writer = new HTMLWriter(writeBuf);
    writer.writeHtmlBegin();
    try{
      writer.writeTargetName("IMAGETARGET");
      writer.writeH1(sheetInformationTitle, null);

      // make links with descrition
      String[][] targets = new String[sheet.size()][5];

      for(int i=0;i<sheet.size();i++){
        Object o = sheet.get(i);
        if (o instanceof AbstractShape) {
          AbstractShape shape = (AbstractShape)o;

          // left-x, top-y, right-x, bottom-y
          targets[i][0] = new Integer(shape.getBounds().x).toString();
          targets[i][1] = new Integer(shape.getBounds().y).toString();
          targets[i][2] = new Integer(shape.getBounds().x + CIRCLE_SIZE+4).toString();
          targets[i][3] = new Integer(shape.getBounds().y + CIRCLE_SIZE+4).toString();

          // target name
          targets[i][4] = getShapeId(shape, i);

        }
      }
      // Write image with links
      writer.writeImage(_imageFile.getName(),resources.getString("imageFileTitle"), "IMAGEMAP", targets);
    }catch (IOException e){
      e.printStackTrace();
    }

    // Create sheet information
    for(int i=0;i<sheet.size();i++){
      Object o = sheet.get(i);
      if (o instanceof AbstractShape) {
        AbstractShape shape = (AbstractShape)o;

        // Shape name
        writer.writeTargetName(getShapeId(shape,i));
        writer.writeH2(getShapeId(shape, i),null);

        // Shape properties
        String[] propertiesNames = shape.getPropertyNames();
        ArrayList contents = new ArrayList();
       
        if (propertiesNames!=null){
          for(int j=0;j<propertiesNames.length;j++){
            String[] property = new String[2];
            property[0] = propertiesNames[j];

            Object obj = shape.getPropertyValue(propertiesNames[j]);
            if (obj!=null){
              if (obj instanceof NamedProperties){
                String[] objPropertiesNames = ((NamedProperties)obj).getPropertyNames();
                String objToString="";
                for(int k=0;k<objPropertiesNames.length;k++){
                  objToString+=objPropertiesNames[k] + " = " + ((NamedProperties)obj).getPropertyValue(objPropertiesNames[k]) + "\n";
                }
                property[1] = objToString;
             
              }else if (obj instanceof DataSource){
                property[1] = DataInfo.getAll(obj);
              }else{
                property[1] = obj.toString();
              }
              contents.add(property)
            }
          }
        }
        writer.writeTab(propertyTabTitles, contents);
        writer.writeP(resources.getString("goBackToImage"), "IMAGETARGET");
        writer.writeSeparator();
      }
    }
    writer.writeHtmlEnd();
    writeBuf.close();
    writeFile.close();
   
   
    // set html chooser for saving
    if(JSynoptic.gui!=null){
      htmlFileChooser = new JFileChooser();
View Full Code Here


  // ----------------------------------------------------------

  public void createSQLLoaderFiles(String sBasePath) throws IOException,SQLException {
    DataRowSet oDatR;
    DataTblDef oTblD;
    FileWriter oFilW;

    if (DebugFile.trace) {
      DebugFile.writeln ("Begin DataStruct.createSQLLoaderFiles(" + sBasePath + ")");
      DebugFile.incIdent();
    }

    prepareStatements();

    for (int t=0; t<cTables; t++) {
      oDatR = getRowSet(t);
      oTblD = TrMetaData[t];
      oFilW = new FileWriter(sBasePath + oDatR.OriginTable + ".CTL", false);
      oFilW.write("LOAD DATA\n");
      oFilW.write("INFILE *\n");
      oFilW.write("REPLACE INTO TABLE " + oDatR.TargetTable +"\n");
      oFilW.write("FIELDS TERMINATED BY \"`\" OPTIONALLY ENCLOSED BY '\"'\n");
      oFilW.write("(\n");
      for (int c=0; c<oTblD.ColCount; c++) {
        oFilW.write("  " + oTblD.ColNames[c]);
        if (oTblD.ColTypes[c]==java.sql.Types.DATE || oTblD.ColTypes[c]==java.sql.Types.TIMESTAMP)
          oFilW.write(" DATE \"YYYY-MM-DD HH24-MI-SS\"");
        oFilW.write(" NULLIF (" + oTblD.ColNames[c] + " = \"NULL\")");
        oFilW.write(c<oTblD.ColCount-1 ? ",\n" : ")\n");
      } // next(c)
      oFilW.write("BEGINDATA\n");
      oFilW.close();
    } // next(t)

    if (DebugFile.trace) {
      DebugFile.decIdent();
      DebugFile.writeln ("End DataStruct.createSQLLoaderFiles()");
View Full Code Here

    // si el registro no está, lo inserta

    DataTblDef oMDat;
    Object oValue;
    int iPK;
    FileWriter TblFiles[] = new FileWriter[cTables];

    if (DebugFile.trace) {
      DebugFile.writeln ("Begin DataStruct.dump(OrPK[], TrPK[], " + String.valueOf(cParams) + ", " + sBasePath + ")");
      DebugFile.incIdent();
    }

    for (int t=0; t<cTables; t++)
      TblFiles[t] = new FileWriter(sBasePath + getRowSet(t).OriginTable + ".CTL", true);

    execCommands("INIT", -1, OrPK, cParams);

    // Iterar sobre las tablas: para cada una de ellas leer sus registros e insertarlos en destino
    for (int s=0; s<cTables; s++) {
View Full Code Here

        {
            final BuildInformation buildInformation = BuildInformation.instance();
            final String uniqueName = getUniqueName(prefix);
            final File exceptionFile = new File(exceptionDirectory, uniqueName);
            result = exceptionFile.getCanonicalPath();
            final PrintWriter writer = new PrintWriter(new FileWriter(exceptionFile));
            writer.println(FILE_HEADER);
            writer.println("Version ........: " + buildInformation.getBuildVersion());
            writer.println("Error ..........: " + message);
            writer.println("Build ..........: " + buildInformation.getBuildDate());
            writer.println("Build System ...: " + buildInformation.getBuildSystem());
View Full Code Here

   }

   private void writePluginsFile(String port, String eventTypes) {
      try {
         String filename = System.getProperty("user.home") + "/tmp/xmlBlasterPluginsTest.xml";
         FileWriter file = new FileWriter(filename);
         file.write("<xmlBlaster>\n");
         file.write("<plugin create='true' id='SOCKET' className='org.xmlBlaster.protocol.socket.SocketDriver'>\n");
         file.write("   <action do='LOAD' onStartupRunlevel='4' sequence='20' \n");
         file.write("           onFail='resource.configuration.pluginFailed'/>\n");
         file.write("   <action do='STOP' onShutdownRunlevel='3' sequence='50'/>   \n");
         file.write("   <attribute id='port'>" + port + "</attribute>\n");
         file.write("   <attribute id='compress/type'></attribute>\n");
         file.write("</plugin>\n");
         file.write("<plugin create='true' id='coreEvents' className='org.xmlBlaster.engine.EventPlugin'>\n");
         file.write("   <action do='LOAD' onStartupRunlevel='8' sequence='4'/>\n");
         file.write("   <action do='STOP' onShutdownRunlevel='7' sequence='4'/>\n");
         file.write("   <attribute id='eventTypes'>\n");
         file.write(eventTypes);
         file.write("   </attribute>\n");
         file.write("   <attribute id='destination.publish'>\n");
         file.write("      publish.content=$_{xml}\n");
         file.write("   </attribute>\n");
         file.write("</plugin>\n");
         file.write("</xmlBlaster>\n");
         file.close();
      }
      catch (Exception ex) {
         ex.printStackTrace();
         fail(ex.getMessage());
      }
View Full Code Here

  }

  private void sign(File infoFile)
    throws IOException
  {
    FileWriter out = new FileWriter(infoFile);
    try {
      out.write(getProcessName());
      out.flush();
    }
    finally {
      out.close();
    }
  }
View Full Code Here

   * @throws IOException
   */
  public static void setAuditFile(String sFilePath) throws IOException {
    if (sAuditFile!="") oLogWriter.close();
    sAuditFile = "";
    oLogWriter = new FileWriter(sFilePath, true);
    sAuditFile = sFilePath;
  } // setAuditFile
View Full Code Here

            model.setParent(null);
            model.setBuild(null);
            model.setDependencies(Collections.EMPTY_LIST);
            model.setDevelopers(Collections.EMPTY_LIST);
            model.setContributors(Collections.EMPTY_LIST);
            final FileWriter fileWriter = new FileWriter(bootstrapPomFile);
            this.project.writeModel(fileWriter);
            fileWriter.flush();

            // - set any removed items back to the way it was since we've written the POM
            model.setParent(parent);
            model.setGroupId(groupId);
            model.setDependencies(dependencies);
View Full Code Here

    oFTPC = new FTPClient(sHost);
    oFTPC.debugResponses(DebugFile.trace);

    if (DebugFile.trace) {
      oFW = new FileWriter("/tmp/javatrc.txt", true);
      oPW = new PrintWriter(oFW, true);
      oFTPC.setLogStream(oPW);
      DebugFile.writeln("FTPClient.login(" + sUser + "," + sPassword + ")");
    }
View Full Code Here

                } else {
                    if (verbose) {
                        System.out.println("Installing Text: " + entry.getName());
                    }

                    BufferedWriter writer = new BufferedWriter(new FileWriter(outFile));
                    BufferedReader reader = new BufferedReader(new InputStreamReader(jin));
                    for (String s = reader.readLine(); s != null; s = reader.readLine()) {
                        writer.write(s);
                        writer.newLine();
                    }
View Full Code Here

TOP

Related Classes of java.io.FileWriter

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.