Java File Read by Charset stringToFile(final String s, final File f, final Charset c)

Here you can find the source of stringToFile(final String s, final File f, final Charset c)

Description

string To File

License

Open Source License

Declaration

public static void stringToFile(final String s, final File f, final Charset c) throws IOException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.File;

import java.io.FileOutputStream;
import java.io.IOException;

import java.nio.charset.Charset;

public class Main {
    public static void stringToFile(final String s, final File f, final Charset c) throws IOException {
        byteArrayToFile(s.getBytes(c), f);
    }// w  w  w  . j av  a 2s . c o m

    public static void byteArrayToFile(final byte[] b, final File f) throws IOException {
        final FileOutputStream fos = new FileOutputStream(f);
        fos.write(b);
        fos.close();
    }
}

Related

  1. saveFile(File file, String content, String charsetName)
  2. saveToFile(File dest, String contents, Charset cs)
  3. setFileText(File file, Charset charset, String text)
  4. setPropertiesVaule(File file, String key, String value, String comments, Charset charset)
  5. setText(File file, Charset charset, String text)
  6. stringToFile(final String string, final Path path, final Charset charset)
  7. toFiles(@Nonnull Process p, @Nonnull Charset charset)
  8. toString(File file, String charset)
  9. toString(final Path filePath, final Charset encoding)