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:m3umaker.exFiles.java

public void genFile(String M3UfileName, List Files) {
    try {/*w  w w .  j  a va  2 s  . c o m*/
        BufferedWriter out = new BufferedWriter(new FileWriter(mDIR + "\\" + M3UfileName + ".m3u", true));
        // System.out.println("----" + mDIR + M3UfileName);
        for (int i = 0; i < Files.size(); i++) {
            out.write(Files.get(i).toString());
            out.newLine();
        }
        out.flush();
        out.close();
    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:com.enioka.jqm.tools.MulticastPrintStream.java

private void write(String s, boolean newLine) {
    BufferedWriter textOut = logger.get();
    try {//from www . ja v a  2 s .c  o  m
        ensureOpen();
        textOut.write(s);
        if (newLine) {
            textOut.newLine();
        }
        textOut.flush();
    } catch (InterruptedIOException x) {
        Thread.currentThread().interrupt();
    } catch (IOException x) {
        // don't log exceptions, it could trigger a StackOverflow
    }
}

From source file:de.electricdynamite.pasty.PastyLoader.java

private void cacheClipboard(JSONArray clipboard) {
    File mDeviceCacheFile = new File(context.getCacheDir(), CACHEFILE);

    try {//from w  w  w.ja va 2 s  .c o m
        mDeviceCacheFile.createNewFile();
        FileWriter fw = new FileWriter(mDeviceCacheFile);
        BufferedWriter bw = new BufferedWriter(fw);
        bw.write(clipboard.toString());
        bw.newLine();
        bw.close();
        if (LOCAL_LOG)
            Log.v(TAG, "cacheClipboard(): Saved result to cache");

    } catch (IOException e) {
        Log.w(TAG, "cacheClipboard(): Could not create cache file");
    }
}

From source file:com.opensource.frameworks.processframework.utils.DefaultPropertiesPersister.java

protected void doStore(Properties props, Writer writer, String header) throws IOException {
    BufferedWriter out = new BufferedWriter(writer);
    if (header != null) {
        out.write("#" + header);
        out.newLine();
    }//ww  w.j a  v a2 s  .com
    out.write("#" + new Date());
    out.newLine();
    for (Enumeration keys = props.keys(); keys.hasMoreElements();) {
        String key = (String) keys.nextElement();
        String val = props.getProperty(key);
        out.write(escape(key, true) + "=" + escape(val, false));
        out.newLine();
    }
    out.flush();
}

From source file:evyframework.common.DefaultPropertiesPersister.java

protected void doStore(Properties props, Writer writer, String header) throws IOException {
    BufferedWriter out = new BufferedWriter(writer);
    if (header != null) {
        out.write("#" + header);
        out.newLine();
    }/* ww w. j ava  2  s. c  om*/
    out.write("#" + new Date());
    out.newLine();
    for (Enumeration<?> keys = props.keys(); keys.hasMoreElements();) {
        String key = (String) keys.nextElement();
        String val = props.getProperty(key);
        out.write(escape(key, true) + "=" + escape(val, false));
        out.newLine();
    }
    out.flush();
}

From source file:de.micromata.genome.util.runtime.config.LocalSettingsWriter.java

protected void storeFileComments(BufferedWriter writer) throws IOException {
    if (StringUtils.isNotBlank(headerComment) == true) {
        PropertiesReadWriter.writeComments(writer, headerComment);
        writer.newLine();
        writer.newLine();// w  w w. j a va 2s .co  m
    }
}

From source file:com.enioka.jqm.tools.MultiplexPrintStream.java

private void write(String s, boolean newLine) {
    BufferedWriter textOut = logger.get();
    try {/* w w w  .j  a  va  2s  . co m*/
        ensureOpen();
        textOut.write(s);
        if (newLine) {
            textOut.newLine();
        }
        textOut.flush();

        if (useCommonLogFile && textOut != original) {
            alljobslogger.info(s + (newLine ? ls : ""));
        }
    } catch (InterruptedIOException x) {
        Thread.currentThread().interrupt();
    } catch (IOException x) {
        // don't log exceptions, it could trigger a StackOverflow
    }
}

From source file:net.stuxcrystal.simpledev.configuration.parser.generators.yaml.CommentAwareDumper.java

/**
 * Writes a newline to the writer.// ww  w.ja  v  a  2s.c om
 *
 * @param writer The writer to write to.
 */
private void _newline(BufferedWriter writer) {
    if (!this.wroteSomething)
        return;

    try {
        writer.newLine();
    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:com.jasonstedman.maven.RequireConfigTransformer.java

public void modifyOutputStream(JarOutputStream jos) throws IOException {
    logger.info("Creating merged data-main script at war path : " + dataMainPath);
    logger.info("Merging require configs matching path pattern : " + configFilePattern);
    logger.info("Using initial define block from : " + initialDefinition);

    Map<String, Object> configBlock = mergeConfigBlocks();

    jos.putNextEntry(new JarEntry(dataMainPath));
    BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(jos));
    writer.write("require.config(");
    writer.write(mapper.writerWithDefaultPrettyPrinter().writeValueAsString(configBlock));
    writer.write(");");
    writer.newLine();
    writer.write(initBlock);//from w  ww  . jav  a2s.  c o m
    writer.flush();
}

From source file:fr.itinerennes.onebusaway.bundle.tasks.GenerateTripsCsvTask.java

/**
 * {@inheritDoc}//ww w.j ava2s. c om
 * 
 * @see java.lang.Runnable#run()
 */
@Override
public void run() {

    BufferedWriter out = null;
    try {
        out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outputFile), CHARSET));

        // output trips count
        out.write(String.valueOf(gtfsDao.getAllTrips().size()));
        out.newLine();

        for (final Trip trip : gtfsDao.getAllTrips()) {

            out.write(trip.getId().toString());
            out.write(';');
            out.write(trip.getRoute().getId().toString());
            out.write(';');
            out.write(trip.getTripHeadsign());
            out.write(';');
            out.write(trip.getDirectionId());
            out.write(';');
            out.newLine();
        }

    } catch (final FileNotFoundException e) {
        LOGGER.error("output file not found", e);
    } catch (final IOException e) {
        LOGGER.error("can't write to output file", e);
    } finally {
        IOUtils.closeQuietly(out);
    }
}