コード例 #1
0
ファイル: SourceStringReader.java プロジェクト: grze/euml
 public String generateImage(OutputStream os, int numImage, FileFormatOption fileFormatOption)
     throws IOException {
   if (blocks.size() == 0) {
     final GraphicStrings error = new GraphicStrings(Arrays.asList("No @startuml found"));
     error.writeImage(os, fileFormatOption);
     return null;
   }
   try {
     for (BlockUml b : blocks) {
       final PSystem system = b.getSystem();
       final int nbInSystem = system.getNbImages();
       if (numImage < nbInSystem) {
         final CMapData cmap = new CMapData();
         system.exportDiagram(os, cmap, numImage, fileFormatOption);
         if (cmap.containsData()) {
           return system.getDescription() + "\n" + cmap.asString("plantuml");
         }
         return system.getDescription();
       }
       numImage -= nbInSystem;
     }
   } catch (InterruptedException e) {
     return null;
   }
   Log.error("numImage is too big = " + numImage);
   return null;
 }
コード例 #2
0
ファイル: OptionFlags.java プロジェクト: sixman9/plantuml-69
  public void logData(File file, PSystem system) {
    final String warnOrError = system.getWarningOrError();
    if (warnOrError == null) {
      return;
    }
    synchronized (logDataInitized) {
      if (logData == null && logDataInitized.get() == false) {
        final String s = GraphvizUtils.getenvLogData();
        if (s != null) {
          setLogData(new File(s));
        }
        logDataInitized.set(true);
      }

      if (logData == null) {
        return;
      }
      // final PSystemError systemError = (PSystemError) system;
      PrintStream ps = null;
      try {
        ps = new PrintStream(new FileOutputStream(logData, true));
        ps.println("Start of " + file.getName());
        ps.println(warnOrError);
        ps.println("End of " + file.getName());
        ps.println();
      } catch (FileNotFoundException e) {
        Log.error("Cannot open " + logData);
        e.printStackTrace();
      } finally {
        if (ps != null) {
          ps.close();
        }
      }
    }
  }