/** * Saves the given configuration into a file specified by the given * filename. * * @param filename the filename * @param config the configuration * @throws IOException if an IOError occurs. */ public void save(final String filename, final Configuration config) throws IOException { save(new File(filename), config); }
final String value = config.getConfigProperty(key); final String description = getDescription(key); if (description != null) { writeDescription(description, out); saveConvert(key, ESCAPE_KEY, out); out.write("="); saveConvert(value, ESCAPE_VALUE, out); out.write(END_OF_LINE);
/** * Writes a descriptive comment into the given print writer. * * @param text the text to be written. If it contains more than * one line, every line will be prepended by the comment character. * @param writer the writer that should receive the content. * @throws IOException if writing fails */ private void writeDescription(final String text, final Writer writer) throws IOException { // check if empty content ... this case is easy ... if (text.length() == 0) { return; } writer.write("# "); writer.write(END_OF_LINE); final LineBreakIterator iterator = new LineBreakIterator(text); while (iterator.hasNext()) { writer.write("# "); saveConvert((String) iterator.next(), ESCAPE_COMMENT, writer); writer.write(END_OF_LINE); } }
final String value = config.getConfigProperty(key); final String description = getDescription(key); if (description != null) { writeDescription(description, out); saveConvert(key, ESCAPE_KEY, out); out.write("="); saveConvert(value, ESCAPE_VALUE, out); out.write(END_OF_LINE);
/** * Writes a descriptive comment into the given print writer. * * @param text the text to be written. If it contains more than * one line, every line will be prepended by the comment character. * @param writer the writer that should receive the content. * @throws IOException if writing fails */ private void writeDescription(final String text, final Writer writer) throws IOException { // check if empty content ... this case is easy ... if (text.length() == 0) { return; } writer.write("# "); writer.write(END_OF_LINE); final LineBreakIterator iterator = new LineBreakIterator(text); while (iterator.hasNext()) { writer.write("# "); saveConvert((String) iterator.next(), ESCAPE_COMMENT, writer); writer.write(END_OF_LINE); } }
final String value = config.getConfigProperty(key); final String description = getDescription(key); if (description != null) { writeDescription(description, out); saveConvert(key, ESCAPE_KEY, out); out.write("="); saveConvert(value, ESCAPE_VALUE, out); out.write(END_OF_LINE);
/** * Saves the given configuration into a file specified by the given * filename. * * @param filename the filename * @param config the configuration * @throws IOException if an IOError occurs. */ public void save(final String filename, final Configuration config) throws IOException { save(new File(filename), config); }
/** * Writes a descriptive comment into the given print writer. * * @param text the text to be written. If it contains more than * one line, every line will be prepended by the comment character. * @param writer the writer that should receive the content. * @throws IOException if writing fails */ private void writeDescription(final String text, final Writer writer) throws IOException { // check if empty content ... this case is easy ... if (text.length() == 0) { return; } writer.write("# "); writer.write(END_OF_LINE); final LineBreakIterator iterator = new LineBreakIterator(text); while (iterator.hasNext()) { writer.write("# "); saveConvert((String) iterator.next(), ESCAPE_COMMENT, writer); writer.write(END_OF_LINE); } }
/** * Saves the given configuration into a file specified by the given * filename. * * @param filename the filename * @param config the configuration * @throws IOException if an IOError occurs. */ public void save(final String filename, final Configuration config) throws IOException { save(new File(filename), config); }
/** * Saves the given configuration into a file specified by the given * file object. * * @param file the target file * @param config the configuration * @throws IOException if an IOError occurs. */ public void save(final File file, final Configuration config) throws IOException { final BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file)); save(out, config); out.close(); }
/** * Saves the given configuration into a file specified by the given * file object. * * @param file the target file * @param config the configuration * @throws IOException if an IOError occurs. */ public void save(final File file, final Configuration config) throws IOException { final BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file)); save(out, config); out.close(); }
/** * Saves the given configuration into a file specified by the given * file object. * * @param file the target file * @param config the configuration * @throws IOException if an IOError occurs. */ public void save(final File file, final Configuration config) throws IOException { final BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file)); save(out, config); out.close(); }