本文整理了Java中com.google.common.io.Files.newWriterSupplier()
方法的一些代码示例,展示了Files.newWriterSupplier()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Files.newWriterSupplier()
方法的具体详情如下:
包路径:com.google.common.io.Files
类名称:Files
方法名:newWriterSupplier
[英]Returns a factory that will supply instances of OutputStreamWriterthat write to a file using the given character set.
[中]返回一个工厂,该工厂将提供使用给定字符集写入文件的OutputStreamWriter实例。
代码示例来源:origin: com.atlassian.bundles/guava
/**
* Returns a factory that will supply instances of {@link OutputStreamWriter}
* that write to a file using the given character set.
*
* @param file the file to write to
* @param charset the character set used when writing the file
* @return the factory
*/
public static OutputSupplier<OutputStreamWriter> newWriterSupplier(File file,
Charset charset) {
return newWriterSupplier(file, charset, false);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
/**
* Returns a factory that will supply instances of {@link OutputStreamWriter}
* that write to a file using the given character set.
*
* @param file the file to write to
* @param charset the charset used to encode the output stream; see {@link
* Charsets} for helpful predefined constants
* @return the factory
*/
public static OutputSupplier<OutputStreamWriter> newWriterSupplier(File file,
Charset charset) {
return newWriterSupplier(file, charset, false);
}
代码示例来源:origin: org.hudsonci.lib.guava/guava
/**
* Returns a factory that will supply instances of {@link OutputStreamWriter}
* that write to a file using the given character set.
*
* @param file the file to write to
* @param charset the charset used to encode the output stream; see {@link
* Charsets} for helpful predefined constants
* @return the factory
*/
public static OutputSupplier<OutputStreamWriter> newWriterSupplier(File file,
Charset charset) {
return newWriterSupplier(file, charset, false);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
/**
* Returns a factory that will supply instances of {@link OutputStreamWriter}
* that write to a file using the given character set.
*
* @param file the file to write to
* @param charset the charset used to encode the output stream; see {@link
* Charsets} for helpful predefined constants
* @return the factory
*/
public static OutputSupplier<OutputStreamWriter> newWriterSupplier(File file,
Charset charset) {
return newWriterSupplier(file, charset, false);
}
代码示例来源:origin: com.google.guava/guava-io
/**
* Returns a factory that will supply instances of {@link OutputStreamWriter}
* that write to a file using the given character set.
*
* @param file the file to write to
* @param charset the character set used when writing the file
* @return the factory
*/
public static OutputSupplier<OutputStreamWriter> newWriterSupplier(File file,
Charset charset) {
return newWriterSupplier(file, charset, false);
}
代码示例来源:origin: org.sonatype.sisu/sisu-guava
/**
* Returns a factory that will supply instances of {@link OutputStreamWriter}
* that write to a file using the given character set.
*
* @param file the file to write to
* @param charset the character set used when writing the file
* @return the factory
*/
public static OutputSupplier<OutputStreamWriter> newWriterSupplier(File file,
Charset charset) {
return newWriterSupplier(file, charset, false);
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
/**
* Returns a factory that will supply instances of {@link OutputStreamWriter}
* that write to a file using the given character set.
*
* @param file the file to write to
* @param charset the charset used to encode the output stream; see {@link
* Charsets} for helpful predefined constants
* @return the factory
*/
public static OutputSupplier<OutputStreamWriter> newWriterSupplier(File file,
Charset charset) {
return newWriterSupplier(file, charset, false);
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/com.google.guava
/**
* Returns a factory that will supply instances of {@link OutputStreamWriter}
* that write to a file using the given character set.
*
* @param file the file to write to
* @param charset the charset used to encode the output stream; see {@link
* Charsets} for helpful predefined constants
* @return the factory
*/
public static OutputSupplier<OutputStreamWriter> newWriterSupplier(File file,
Charset charset) {
return newWriterSupplier(file, charset, false);
}
代码示例来源:origin: com.google.guava/guava-jdk5
/**
* Returns a factory that will supply instances of {@link OutputStreamWriter}
* that write to a file using the given character set.
*
* @param file the file to write to
* @param charset the charset used to encode the output stream; see {@link
* Charsets} for helpful predefined constants
* @return the factory
* @deprecated Use {@link #asCharSink(File, Charset)}. This method is
* scheduled for removal in Guava 18.0.
*/
@Deprecated
public static OutputSupplier<OutputStreamWriter> newWriterSupplier(File file,
Charset charset) {
return newWriterSupplier(file, charset, false);
}
代码示例来源:origin: Nextdoor/bender
/**
* Returns a factory that will supply instances of {@link OutputStreamWriter}
* that write to a file using the given character set.
*
* @param file the file to write to
* @param charset the charset used to encode the output stream; see {@link
* Charsets} for helpful predefined constants
* @return the factory
* @deprecated Use {@link #asCharSink(File, Charset)}. This method is
* scheduled for removal in Guava 18.0.
*/
@Deprecated
public static OutputSupplier<OutputStreamWriter> newWriterSupplier(File file,
Charset charset) {
return newWriterSupplier(file, charset, false);
}
代码示例来源:origin: com.atlassian.bundles/guava
/**
* Private helper method. Writes a character sequence to a file,
* optionally appending.
*
* @param from the character sequence to append
* @param to the destination file
* @param charset the character set used when writing the file
* @param append true to append, false to overwrite
* @throws IOException if an I/O error occurs
*/
private static void write(CharSequence from, File to, Charset charset,
boolean append) throws IOException {
CharStreams.write(from, newWriterSupplier(to, charset, append));
}
代码示例来源:origin: com.google.guava/guava-io
/**
* Copies to a file all characters from a {@link Readable} and
* {@link Closeable} object supplied by a factory, using the given
* character set.
*
* @param from the readable supplier
* @param to the destination file
* @param charset the character set used when writing the file
* @throws IOException if an I/O error occurs
*/
public static <R extends Readable & Closeable> void copy(
InputSupplier<R> from, File to, Charset charset) throws IOException {
CharStreams.copy(from, newWriterSupplier(to, charset));
}
代码示例来源:origin: com.google.guava/guava-io
/**
* Private helper method. Writes a character sequence to a file,
* optionally appending.
*
* @param from the character sequence to append
* @param to the destination file
* @param charset the character set used when writing the file
* @param append true to append, false to overwrite
* @throws IOException if an I/O error occurs
*/
private static void write(CharSequence from, File to, Charset charset,
boolean append) throws IOException {
CharStreams.write(from, newWriterSupplier(to, charset, append));
}
代码示例来源:origin: org.sonatype.sisu/sisu-guava
/**
* Copies to a file all characters from a {@link Readable} and
* {@link Closeable} object supplied by a factory, using the given
* character set.
*
* @param from the readable supplier
* @param to the destination file
* @param charset the character set used when writing the file
* @throws IOException if an I/O error occurs
*/
public static <R extends Readable & Closeable> void copy(
InputSupplier<R> from, File to, Charset charset) throws IOException {
CharStreams.copy(from, newWriterSupplier(to, charset));
}
代码示例来源:origin: org.sonatype.sisu/sisu-guava
/**
* Private helper method. Writes a character sequence to a file,
* optionally appending.
*
* @param from the character sequence to append
* @param to the destination file
* @param charset the character set used when writing the file
* @param append true to append, false to overwrite
* @throws IOException if an I/O error occurs
*/
private static void write(CharSequence from, File to, Charset charset,
boolean append) throws IOException {
CharStreams.write(from, newWriterSupplier(to, charset, append));
}
代码示例来源:origin: com.atlassian.bundles/guava
/**
* Copies to a file all characters from a {@link Readable} and
* {@link Closeable} object supplied by a factory, using the given
* character set.
*
* @param from the readable supplier
* @param to the destination file
* @param charset the character set used when writing the file
* @throws IOException if an I/O error occurs
*/
public static <R extends Readable & Closeable> void copy(
InputSupplier<R> from, File to, Charset charset) throws IOException {
CharStreams.copy(from, newWriterSupplier(to, charset));
}
代码示例来源:origin: Noahs-ARK/semafor
if (iteration % SAVE_EVERY_K == 0) {
final String modelFilename = String.format("%s_%05d", modelFilePrefix, iteration);
saveModel(riso.numerical.LBFGS.solution_cache, newWriterSupplier(new File(modelFilename), Charsets.UTF_8));
saveModel(riso.numerical.LBFGS.solution_cache, newWriterSupplier(new File(modelFilename), Charsets.UTF_8));
return currentParams;
代码示例来源:origin: eksopl/asagi
debugOut = new BufferedWriter(Files.newWriterSupplier(debugFile, Charsets.UTF_8, true).getOutput());
} catch(IOException e1) {
System.err.println("WARN: Cannot write to debug file");
代码示例来源:origin: Noahs-ARK/semafor
/**
* required flags:
* model-dir
* input-file
* output-file
*/
public static void main(String[] args) throws Exception {
final FNModelOptions options = new FNModelOptions(args);
final File inputFile = new File(options.inputFile.get());
final File outputFile = new File(options.outputFile.get());
final String modelDirectory = options.modelDirectory.get();
final int numThreads = options.numThreads.present() ? options.numThreads.get() : 1;
final Semafor semafor = getSemaforInstance(modelDirectory);
semafor.runParser(
Files.newReaderSupplier(inputFile, Charsets.UTF_8),
Files.newWriterSupplier(outputFile, Charsets.UTF_8),
numThreads);
}
内容来源于网络,如有侵权,请联系作者删除!