Example usage for java.io BufferedWriter newLine

List of usage examples for java.io BufferedWriter newLine

Introduction

In this page you can find the example usage for java.io BufferedWriter newLine.

Prototype

public void newLine() throws IOException 

Source Link

Document

Writes a line separator.

Usage

From source file:com.zimbra.cs.util.ProxyConfOverride.java

/**
 * Read from template file and translate the contents to conf
 *//*  w ww.  j a v  a 2s.  c o m*/
private static void expandTemplateSimple(BufferedReader temp, BufferedWriter conf) throws IOException {
    String line;
    while ((line = temp.readLine()) != null) {
        line = StringUtil.fillTemplate(line, mVars);
        conf.write(line);
        conf.newLine();
    }
}

From source file:com.alibaba.rocketmq.filtersrv.filter.DynaCode.java

private String[] uploadSrcFile() throws Exception {
    List<String> srcFileAbsolutePaths = new ArrayList<String>(codeStrs.size());
    for (String code : codeStrs) {
        if (StringUtils.isNotBlank(code)) {
            String packageName = getPackageName(code);
            String className = getClassName(code);
            if (StringUtils.isNotBlank(className)) {
                File srcFile = null;
                BufferedWriter bufferWriter = null;
                try {
                    if (StringUtils.isBlank(packageName)) {
                        File pathFile = new File(sourcePath);

                        if (!pathFile.exists()) {
                            if (!pathFile.mkdirs()) {
                                throw new RuntimeException("create PathFile Error!");
                            }//from   ww  w .  ja  v  a 2s.  c  o m
                        }
                        srcFile = new File(sourcePath + FILE_SP + className + ".java");
                    } else {
                        String srcPath = StringUtils.replace(packageName, ".", FILE_SP);
                        File pathFile = new File(sourcePath + FILE_SP + srcPath);

                        if (!pathFile.exists()) {
                            if (!pathFile.mkdirs()) {
                                throw new RuntimeException("create PathFile Error!");
                            }
                        }
                        srcFile = new File(pathFile.getAbsolutePath() + FILE_SP + className + ".java");
                    }
                    synchronized (loadClass) {
                        loadClass.put(getFullClassName(code), null);
                    }
                    if (null != srcFile) {
                        logger.warn("Dyna Create Java Source File:---->" + srcFile.getAbsolutePath());
                        srcFileAbsolutePaths.add(srcFile.getAbsolutePath());
                        srcFile.deleteOnExit();
                    }
                    OutputStreamWriter outputStreamWriter = new OutputStreamWriter(
                            new FileOutputStream(srcFile), encoding);
                    bufferWriter = new BufferedWriter(outputStreamWriter);
                    for (String lineCode : code.split(LINE_SP)) {
                        bufferWriter.write(lineCode);
                        bufferWriter.newLine();
                    }
                    bufferWriter.flush();
                } finally {
                    if (null != bufferWriter) {
                        bufferWriter.close();
                    }
                }
            }
        }
    }
    return srcFileAbsolutePaths.toArray(new String[srcFileAbsolutePaths.size()]);
}

From source file:gdsc.smlm.ij.plugins.TraceDiffusion.java

private void saveTraceDistances(int nTraces, ArrayList<double[]> distances, StoredDataStatistics msdPerMolecule,
        StoredDataStatistics msdPerMoleculeAdjacent, StoredDataStatistics dStarPerMolecule,
        StoredDataStatistics dStarPerMoleculeAdjacent) {
    distancesFilename = Utils.getFilename("Trace_Distances_File", distancesFilename);
    if (distancesFilename != null) {
        distancesFilename = Utils.replaceExtension(distancesFilename, "xls");

        BufferedWriter out = null;
        try {/*from  w  ww. j  a v  a 2  s  . c  o  m*/
            FileOutputStream fos = new FileOutputStream(distancesFilename);
            out = new BufferedWriter(new OutputStreamWriter(fos, "UTF-8"));
            double[] msd = msdPerMolecule.getValues();
            double[] msd2 = msdPerMoleculeAdjacent.getValues();
            double[] dStar = dStarPerMolecule.getValues();
            double[] dStar2 = dStarPerMoleculeAdjacent.getValues();
            out.write(String.format("#%d traces : Precision = %s nm : Exposure time = %s s", nTraces,
                    Utils.rounded(precision, 4), Utils.rounded(exposureTime, 4)));
            out.newLine();
            out.write(String.format(
                    "#TraceId\tMSD all-vs-all (um^2/s)\tMSD adjacent (um^2/s)\tD* all-vs-all(um^2/s)\tD* adjacent(um^2/s)\tDistances (um^2) per %ss ... ",
                    Utils.rounded(exposureTime, 4)));
            out.newLine();
            for (int i = 0; i < msd.length; i++) {
                out.write(Integer.toString(i + 1));
                out.write('\t');
                out.write(Utils.rounded(msd[i], 4));
                out.write('\t');
                out.write(Utils.rounded(msd2[i], 4));
                out.write('\t');
                out.write(Utils.rounded(dStar[i], 4));
                out.write('\t');
                out.write(Utils.rounded(dStar2[i], 4));
                for (double d : distances.get(i)) {
                    out.write('\t');
                    out.write(Utils.rounded(d, 4));
                }
                out.newLine();
            }
        } catch (Exception e) {
        } finally {
            if (out != null) {
                try {
                    out.close();
                } catch (IOException e) {
                }
            }
        }
    }
}

From source file:gui.GW2EventerGui.java

/**
 * Creates new form GW2EventerGui//from w ww . ja v a  2  s  . c om
 */
public GW2EventerGui() {

    this.guiIcon = new ImageIcon(ClassLoader.getSystemResource("media/icon.png")).getImage();

    if (System.getProperty("os.name").startsWith("Windows")) {
        this.OS = "Windows";
        this.isWindows = true;
    } else {
        this.OS = "Other";
        this.isWindows = false;
    }

    if (this.isWindows == true) {
        this.checkIniDir();
    }

    initComponents();

    this.speakQueue = new LinkedList();

    this.speakRunnable = new Runnable() {

        @Override
        public void run() {

            String path = System.getProperty("user.home") + "\\.gw2eventer";
            File f;
            String sentence;

            while (!speakQueue.isEmpty()) {

                f = new File(path + "\\tts.vbs");

                if (!f.exists() && !f.isDirectory()) {

                    sentence = (String) speakQueue.poll();

                    try {

                        Writer writer = new OutputStreamWriter(
                                new FileOutputStream(
                                        System.getProperty("user.home") + "\\.gw2eventer\\tts.vbs"),
                                "ISO-8859-15");
                        BufferedWriter fout = new BufferedWriter(writer);

                        fout.write("Dim Speak");
                        fout.newLine();
                        fout.write("Set Speak=CreateObject(\"sapi.spvoice\")");
                        fout.newLine();
                        fout.write("Speak.Speak \"" + sentence + "\"");

                        fout.close();

                        Runtime rt = Runtime.getRuntime();

                        try {
                            if (sentence.length() > 0) {
                                Process p = rt.exec(System.getProperty("user.home") + "\\.gw2eventer\\tts.bat");
                            }
                        } catch (IOException ex) {
                            Logger.getLogger(GW2EventerGui.class.getName()).log(Level.SEVERE, null, ex);
                        }
                    } catch (FileNotFoundException ex) {
                        Logger.getLogger(GW2EventerGui.class.getName()).log(Level.SEVERE, null, ex);
                    } catch (IOException ex) {
                        Logger.getLogger(GW2EventerGui.class.getName()).log(Level.SEVERE, null, ex);
                    }

                    try {
                        Thread.sleep(3000);
                    } catch (InterruptedException ex) {
                        Logger.getLogger(GW2EventerGui.class.getName()).log(Level.SEVERE, null, ex);
                    }
                } else {
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException ex) {
                        Logger.getLogger(GW2EventerGui.class.getName()).log(Level.SEVERE, null, ex);
                    }
                }
            }
        }
    };

    this.matchIds = new HashMap();
    this.matchId = "2-6";
    this.matchIdColor = "green";

    this.jLabelNewVersion.setVisible(false);
    this.updateInformed = false;

    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    this.setLocation(screenSize.width / 2 - this.getSize().width / 2,
            (screenSize.height / 2 - this.getSize().height / 2) - 20);

    double width = screenSize.getWidth();
    double height = screenSize.getHeight();

    if ((width == 1280) && (height == 720 || height == 768 || height == 800)) {
        this.setExtendedState(this.MAXIMIZED_BOTH);
        //this.setLocation(0, 0);
    }

    JSpinner.NumberEditor jsEditor = (JSpinner.NumberEditor) this.jSpinnerRefreshTime.getEditor();
    DefaultFormatter formatter = (DefaultFormatter) jsEditor.getTextField().getFormatter();
    formatter.setAllowsInvalid(false);

    /*
     jsEditor = (JSpinner.NumberEditor)this.jSpinnerOverlayX.getEditor();
     formatter = (DefaultFormatter) jsEditor.getTextField().getFormatter();
     formatter.setAllowsInvalid(false);
            
     jsEditor = (JSpinner.NumberEditor)this.jSpinnerOverlayY.getEditor();
     formatter = (DefaultFormatter) jsEditor.getTextField().getFormatter();
     formatter.setAllowsInvalid(false);
     */
    this.workingButton = this.jButtonRefresh;
    this.refreshSelector = this.jCheckBoxAutoRefresh;

    this.addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(WindowEvent e) {

            apiManager.saveSettingstoFile();
            System.exit(0);
        }
    });

    this.pushGui = new PushGui(this, true, "", "");
    this.pushGui.setIconImage(guiIcon);

    this.donateGui = new DonateGui(this, true);
    this.donateGui.setIconImage(guiIcon);

    this.infoGui = new InfoGui(this, true);
    this.infoGui.setIconImage(guiIcon);

    this.feedbackGui = new FeedbackGui(this, true);
    this.feedbackGui.setIconImage(guiIcon);

    this.overlayGui = new OverlayGui(this);
    this.initOverlayGui();

    this.settingsOverlayGui = new SettingsOverlayGui(this);
    this.initSettingsOverlayGui();

    this.wvwOverlayGui = new WvWOverlayGui(this);
    this.initWvwOverlayGui();

    this.language = "en";
    this.worldID = "2206"; //Millersund [DE]

    this.setTranslations();

    this.eventLabels = new ArrayList();
    this.eventLabelsTimer = new ArrayList();

    this.homeWorlds = new HashMap();

    this.preventSystemSleep = true;

    for (int i = 1; i <= EVENT_COUNT; i++) {

        try {

            Field f = getClass().getDeclaredField("labelEvent" + i);
            JLabel l = (JLabel) f.get(this);
            l.setPreferredSize(new Dimension(70, 28));
            //l.setToolTipText("");

            //int width2 = l.getX();
            //int height2 = l.getY();
            //System.out.println("$coords .= \"{\\\"x\\\": \\\""+ width2 + "\\\", \\\"y\\\": \\\""+ height2 + "\\\"},\\n\";");
            this.eventLabels.add(l);

            final int ii = i;

            l.addMouseListener(new java.awt.event.MouseAdapter() {
                @Override
                public void mousePressed(java.awt.event.MouseEvent evt) {
                    showSoundSelector(ii);
                }
            });

            f = getClass().getDeclaredField("labelTimer" + i);
            l = (JLabel) f.get(this);
            l.setEnabled(true);
            l.setVisible(false);
            l.setForeground(Color.green);

            //int width2 = l.getX();
            //int height2 = l.getY();
            //System.out.println("$coords2 .= \"{\\\"x\\\": \\\""+ width2 + "\\\", \\\"y\\\": \\\""+ height2 + "\\\"},\\n\";");
            this.eventLabelsTimer.add(l);

        } catch (NoSuchFieldException | SecurityException | IllegalArgumentException
                | IllegalAccessException ex) {
            Logger.getLogger(GW2EventerGui.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    int[] disabledEvents = { 6, 8, 11, 12, 17, 18, 19, 20, 21, 22 };

    for (int i = 0; i < disabledEvents.length; i++) {

        Field f;
        JLabel l;

        try {
            f = getClass().getDeclaredField("labelEvent" + disabledEvents[i]);
            l = (JLabel) f.get(this);
            l.setEnabled(false);
            l.setVisible(false);

            f = getClass().getDeclaredField("labelTimer" + disabledEvents[i]);
            l = (JLabel) f.get(this);
            l.setEnabled(false);
            l.setVisible(false);
        } catch (NoSuchFieldException | SecurityException | IllegalArgumentException
                | IllegalAccessException ex) {
            Logger.getLogger(GW2EventerGui.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    this.lastPush = new Date();

    if (this.apiManager == null) {

        this.apiManager = new ApiManager(this, this.jSpinnerRefreshTime, this.jCheckBoxAutoRefresh.isSelected(),
                this.eventLabels, this.language, this.worldID, this.homeWorlds, this.jComboBoxHomeWorld,
                this.jLabelServer, this.jLabelWorking, this.jCheckBoxPlaySounds.isSelected(),
                this.workingButton, this.refreshSelector, this.eventLabelsTimer, this.jComboBoxLanguage,
                this.overlayGui, this.jCheckBoxWvWOverlay);
    }

    //this.wvwMatchReader = new WvWMatchReader(this.matchIds, this.jCheckBoxWvW);
    //this.wvwMatchReader.start();
    this.preventSleepMode();
    this.runUpdateService();
    this.runPushService();
    this.runTips();
    //this.runTest();
}

From source file:hu.sztaki.lpds.pgportal.portlets.credential.MyProxyPortlet.java

/**
 * Saves the proxy certificate under the user's directory.
 * @param usr String containing user id/*w  ww  . j  a  va2 s .c o m*/
 * @return String
 * @throws Exception
 */
private String saveUsrCert(String usr) throws Exception {
    String usrDir = this.loadUsersDirPath() + usr + "/";
    File uDir = new File(usrDir);
    if (!uDir.exists()) {
        if (!uDir.mkdirs()) {
            return null;
        }
    }
    FileWriter tmp = new FileWriter(usrDir + "/.creds");
    BufferedWriter out = new BufferedWriter(tmp);
    SZGCredential[] creds = this.cm.getCredentials(usr);
    if (creds == null) {
    }
    try {
        if (creds != null) {
            int credNum = creds.length;

            for (int j = 0; j < credNum; j++) {
                SZGCredential cred = (SZGCredential) creds[j];
                String credId = cred.getId();
                String[] gs = SZGCredentialManager.getInstance().getSetGridsForCredential(usr, credId, true);
                StringBuffer gsVal = new StringBuffer("");
                if (gs != null && gs.length != 0) {
                    for (int i = 0; i < gs.length; i++) {
                        gsVal.append(gs[i]);
                        if (i != (gs.length - 1)) {
                            gsVal.append(" ;");
                        }
                    }
                }
                if (!" ;".equals(gsVal.toString())) {
                    out.write(cred.getId() + ";" + cred.getDownloadedFrom() + ";" + cred.getTimeLeftInSeconds()
                            + ";" + cred.getDescription() + " ;#" + gsVal.toString() + " ;");
                }
                if (j != credNum) {
                    out.newLine();
                }
            }
        }
        out.close();
    } catch (Exception e) {
    }
    return " ";
}

From source file:gdsc.smlm.ij.plugins.pcpalm.PCPALMFitting.java

private void saveCorrelationCurve(double[][] gr, double[]... curves) {
    if (!saveCorrelationCurve)
        return;//from w  ww .  ja va 2s . c om
    outputFilename = Utils.getFilename("Output_Correlation_File", outputFilename);
    if (outputFilename != null) {
        outputFilename = Utils.replaceExtension(outputFilename, "xls");

        BufferedWriter output = null;
        try {
            output = new BufferedWriter(new FileWriter(outputFilename));
            writeHeader(output, HEADER_PEAK_DENSITY, Double.toString(previous_peakDensity));
            writeHeader(output, HEADER_SPATIAL_DOMAIN, Boolean.toString(previous_spatialDomain));
            output.write("#r\tg(r)\tS.E.");
            for (int j = 0; j < curves.length; j++)
                output.write(String.format("\tModel %d", j + 1));
            output.newLine();
            // Ignore the r=0 value by starting with an offset if necessary
            for (int i = offset; i < gr[0].length; i++) {
                output.write(String.format("%f\t%f\t%f", gr[0][i], gr[1][i], gr[2][i]));
                for (int j = 0; j < curves.length; j++)
                    output.write(String.format("\t%f", curves[j][i - offset]));
                output.newLine();
            }
        } catch (Exception e) {
            // Q. Add better handling of errors?
            e.printStackTrace();
            IJ.log("Failed to save correlation curve to file: " + outputFilename);
        } finally {
            if (output != null) {
                try {
                    output.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

From source file:com.zimbra.cs.util.ProxyConfOverride.java

/**
 * Read from template file and translate the contents to conf.
 * The template will be cached and returned
 *///from   w w  w .  j  ava2s.c  om
private static List<String> expandTemplateAndCache(BufferedReader temp, BufferedWriter conf)
        throws IOException {
    String line;
    ArrayList<String> cache = new ArrayList<String>(50);
    while ((line = temp.readLine()) != null) {
        if (!line.startsWith("#"))
            cache.add(line); // cache only non-comment lines
        line = StringUtil.fillTemplate(line, mVars);
        conf.write(line);
        conf.newLine();
    }
    return cache;
}

From source file:net.rptools.maptool.launcher.MapToolLauncher.java

private void saveCfgFile() {
    String baseDir, targetDir, relDir;

    final Map<String, Object> values = new HashMap<String, Object>(15);
    values.put("MAXMEM", maxMemVal); //$NON-NLS-1$
    values.put("MINMEM", minMemVal); //$NON-NLS-1$
    values.put("STACKSIZE", stackSizeVal); //$NON-NLS-1$
    values.put("CONSOLE", startConsole); //$NON-NLS-1$
    values.put("PROMPT", promptUser); //$NON-NLS-1$
    values.put("RELATIVE_PATHS", jcbRelativePath.isSelected()); //$NON-NLS-1$
    if (!mapToolLocale.isEmpty()) {
        values.put("LOCALE", mapToolLocale);
    }/*from   w  ww.j  av a 2s.co  m*/

    // Force trailing separators so relative path can be constructed properly
    baseDir = currentDir.getAbsolutePath() + File.separator;
    //      baseDir = "E:\\MapTool\\MapTool V1-3b89\\"; // For testing the relative pathing routines

    relDir = mapToolJarDir.getAbsolutePath();
    if (jcbRelativePath.isSelected()) {
        targetDir = relDir + File.separator;
        //         targetDir = "E:\\MapTool\\MapTool V1-3b89\\";
        try {
            relDir = PathUtils.getRelativePath(targetDir, baseDir);
        } catch (final PathResolutionException e) {
            // If there is no common path, just use the original string.
        }
    }
    values.put("MAPTOOL_DIRECTORY", relDir); //$NON-NLS-1$

    values.put("EXECUTABLE", mapToolJarName); //$NON-NLS-1$

    baseDir = mapToolJarDir.getAbsolutePath() + File.separator;
    if (mapToolDataDir != null && !mapToolDataDir.isEmpty()) {
        relDir = mapToolDataDir;
        if (jcbRelativePath.isSelected()) {
            targetDir = relDir + File.separator;
            try {
                relDir = PathUtils.getRelativePath(targetDir, baseDir);
            } catch (final PathResolutionException e) {
                // If there is no common path, just use the original string.
            }
        }
        values.put("MAPTOOL_DATADIR", relDir); //$NON-NLS-1$
    }
    if (javaDir != null && !javaDir.isEmpty()) {
        relDir = javaDir;
        if (jcbRelativePath.isSelected()) {
            targetDir = relDir + File.separator;
            try {
                relDir = PathUtils.getRelativePath(targetDir, baseDir);
            } catch (final PathResolutionException e) {
                // If there is no common path, just use the original string.
            }
        }
        values.put("JAVA_DIRECTORY", relDir); //$NON-NLS-1$
    }
    if (extraArgs != null && !extraArgs.isEmpty()) {
        values.put("ARGS", extraArgs.trim()); //$NON-NLS-1$
    }
    values.put("LOGGING", getLoggingString()); //$NON-NLS-1$

    // Check to see if anything is different from the configuration we read in earlier.
    // If it's all the same, no reason to write a new one, right?
    int writeNewFile = 0;
    for (final String key : recognizedFields) {
        if (!originalSettings.containsKey(key)
                || (values.containsKey(key) && originalSettings.get(key).equals(values.get(key)))) {
            writeNewFile++;
        }
    }
    if (writeNewFile == originalSettings.size()) {
        // no need to write the file if all of the settings are identical
        return;
    }
    // Create another map for comments that should precede any particular field.
    final Map<String, String> comments = new HashMap<String, String>();
    comments.put("MAXMEM", CopiedFromOtherJars.getText("msg.info.comment.MAXMEM")); //$NON-NLS-1$ //$NON-NLS-2$
    comments.put("MINMEM", CopiedFromOtherJars.getText("msg.info.comment.MINMEM")); //$NON-NLS-1$ //$NON-NLS-2$
    comments.put("STACKSIZE", CopiedFromOtherJars.getText("msg.info.comment.STACKSIZE")); //$NON-NLS-1$ //$NON-NLS-2$
    comments.put("MAPTOOL_DATADIR", CopiedFromOtherJars.getText("msg.info.comment.MAPTOOL_DATADIR")); //$NON-NLS-1$ //$NON-NLS-2$
    comments.put("MAPTOOL_DIRECTORY", CopiedFromOtherJars.getText("msg.info.comment.MAPTOOL_DIRECTORY")); //$NON-NLS-1$ //$NON-NLS-2$
    comments.put("EXECUTABLE", CopiedFromOtherJars.getText("msg.info.comment.EXECUTABLE")); //$NON-NLS-1$ //$NON-NLS-2$
    comments.put("LOCALE", CopiedFromOtherJars.getText("msg.info.comment.LOCALE")); //$NON-NLS-1$ //$NON-NLS-2$
    comments.put("LOGGING", CopiedFromOtherJars.getText("msg.info.comment.LOGGING")); //$NON-NLS-1$ //$NON-NLS-2$
    comments.put("JAVA_DIRECTORY", CopiedFromOtherJars.getText("msg.info.comment.JAVA_DIRECTORY")); //$NON-NLS-1$ //$NON-NLS-2$
    comments.put("ARGS", CopiedFromOtherJars.getText("msg.info.comment.ARGS")); //$NON-NLS-1$ //$NON-NLS-2$

    BufferedWriter br = null;
    Exception ex = null;
    try {
        br = new BufferedWriter(new FileWriter(cfgFile));
        br.write(CopiedFromOtherJars.getText("msg.info.comment.01")); //$NON-NLS-1$
        br.write(CopiedFromOtherJars.getText("msg.info.comment.02")); //$NON-NLS-1$
        br.write(CopiedFromOtherJars.getText("msg.info.comment.03")); //$NON-NLS-1$
        br.write(CopiedFromOtherJars.getText("msg.info.comment.04")); //$NON-NLS-1$
        br.write(CopiedFromOtherJars.getText("msg.info.comment.05")); //$NON-NLS-1$
        br.write("#\n"); //$NON-NLS-1$
        for (String key : recognizedFields) {
            if (comments.containsKey(key)) {
                br.write("# " + comments.get(key).toString()); //$NON-NLS-1$
                br.newLine();
            }
            Object v = values.get(key);
            if (v == null) {
                // No values was assigned, so leave a placeholder in the config file.
                br.write("#" + key + "="); //$NON-NLS-1$ $NON-NLS-2$
            } else {
                br.write(key + "=" + v.toString()); //$NON-NLS-1$
                values.remove(key);
            }
            br.newLine();
        }
    } catch (final IOException e) {
        ex = e;
    } finally {
        try {
            br.close();
        } catch (final IOException e) {
            ex = e;
        }
        if (ex != null) {
            logMsg(Level.SEVERE, "Configuration file {0} is unwritable", "msg.error.configUnwritable", cfgFile,
                    ex);
        }
    }
    if (!values.isEmpty())
        logMsg(Level.SEVERE, "Programming error: values.isEmpty() is not true!", null);
}

From source file:com.zimbra.cs.util.ProxyConfOverride.java

/**
 * Enumerate all domains, if the required attrs are valid, generate the
 * "server" block according to the template.
 * @author Jiankuan/* ww  w  . j a  va2  s. c o  m*/
 * @throws ProxyConfException
 * @deprecated use expandTemplateByExplodeDomain instead
 */
@Deprecated
private static void expandTemplateExplodeSSLConfigsForAllVhnsAndVIPs(BufferedReader temp, BufferedWriter conf)
        throws IOException, ProxyConfException {
    int size = mDomainReverseProxyAttrs.size();
    List<String> cache = null;

    if (size > 0) {
        Iterator<DomainAttrItem> it = mDomainReverseProxyAttrs.iterator();
        DomainAttrItem item = it.next();
        fillVarsWithDomainAttrs(item);
        cache = expandTemplateAndCache(temp, conf);
        conf.newLine();

        while (it.hasNext()) {
            item = it.next();
            fillVarsWithDomainAttrs(item);
            expandTempateFromCache(cache, conf);
            conf.newLine();
        }
    }
}

From source file:io.snappydata.hydra.cluster.SnappyTest.java

protected void writeToFile(String logDir, File file) {
    try {/*from ww  w  . j  a va  2 s.  c  o  m*/
        FileWriter fw = new FileWriter(file.getAbsoluteFile(), true);
        BufferedWriter bw = new BufferedWriter(fw);
        bw.write(logDir);
        bw.newLine();
        bw.close();
    } catch (IOException e) {
        throw new TestException("Error occurred while writing to a file: " + file + e.getMessage());
    }
}