Makefile added / pkg-config descriptor
[metux-java.git] / util / StoreFile.java
blobd96d113501c86f4e6b40f16c260ed1b7697c2002
2 package org.de.metux.util;
4 import java.io.IOException;
5 import java.io.FileWriter;
6 import java.io.File;
8 public class StoreFile
10 public static boolean store(File file, String text)
12 return store(file.getAbsolutePath(),text);
15 public static boolean store(String filename, String text)
17 try
19 FileWriter wr = new FileWriter(filename,false);
20 wr.write(text,0,text.length());
21 wr.flush();
22 wr.close();
23 return true;
25 catch (IOException e)
27 return false;
33 public static boolean store(String filename, String text, String mode)
35 if (!store(filename,text))
36 return false;
38 return FileOps.chmod(filename,mode);