diff options
| author | Mike Lockwood <lockwood@android.com> | 2011-05-31 16:14:08 -0700 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-05-31 16:14:08 -0700 |
| commit | b0aee3ee430ce79430ba16e53109840db5bc342a (patch) | |
| tree | d7f3749d92900a07b4fecbab2ef4bd53ae928a95 /core/java | |
| parent | b530abcff5ae8e5ebb75ec6aa42b7c7c190e98a5 (diff) | |
| parent | da8bb74b9d9ffcb095815db800d0816c411f1fba (diff) | |
| download | frameworks_base-b0aee3ee430ce79430ba16e53109840db5bc342a.zip frameworks_base-b0aee3ee430ce79430ba16e53109840db5bc342a.tar.gz frameworks_base-b0aee3ee430ce79430ba16e53109840db5bc342a.tar.bz2 | |
Merge "Move stringToFile utility from ConnectivityService to FileUtils"
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/os/FileUtils.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/core/java/android/os/FileUtils.java b/core/java/android/os/FileUtils.java index f56f6a9..eb0cf37 100644 --- a/core/java/android/os/FileUtils.java +++ b/core/java/android/os/FileUtils.java @@ -20,6 +20,7 @@ import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; +import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -226,4 +227,20 @@ public class FileUtils input.close(); } } + + /** + * Writes string to file. Basically same as "echo -n $string > $filename" + * + * @param filename + * @param string + * @throws IOException + */ + public static void stringToFile(String filename, String string) throws IOException { + FileWriter out = new FileWriter(filename); + try { + out.write(string); + } finally { + out.close(); + } + } } |
