-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFUtil.java
More file actions
45 lines (37 loc) · 727 Bytes
/
FUtil.java
File metadata and controls
45 lines (37 loc) · 727 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import java.io.*;
/** @author Gergely Kota
File Utilities
*/
public class FUtil
{
public static String toString(File f)
{
try
{
BufferedReader br = new BufferedReader(new FileReader(f));
StringBuffer sb = new StringBuffer();
while(br.ready())
sb.append(br.readLine()).append("\n");
return sb.toString();
}
catch(Exception e) {return null;}
}
public static void write(String s, File to)
{
try
{
PrintWriter pw = new PrintWriter(new FileWriter(to));
pw.println(s);
pw.close();
}
catch(Exception e) {}
}
public static String webfix(String s)
{
s = s.trim();
String temp = s.toLowerCase();
if(temp.indexOf("http://") == 0)
return s;
return "http://"+s;
}
}