-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSMSLogResult.java
More file actions
executable file
·44 lines (39 loc) · 1.05 KB
/
SMSLogResult.java
File metadata and controls
executable file
·44 lines (39 loc) · 1.05 KB
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
package com.killmalware.bbsec;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Date;
import javax.microedition.io.Connector;
import javax.microedition.io.file.FileConnection;
import net.rim.device.api.i18n.SimpleDateFormat;
public class SMSLogResult {
private static String logFileName()
{
Date dt = new Date();
SimpleDateFormat sfd = new SimpleDateFormat("dd-MM-yy");
return "file:///store/home/user/bbsexurity-result-"+sfd.formatLocal(dt.getTime())+".txt";
}
public static void logSMS(String alert, String num)
{
String line = alert+ ", "+num+"\r\n";
try
{
FileConnection conn = (FileConnection)Connector.open(logFileName(), Connector.READ_WRITE);
long x = 0;
if(!conn.exists())
{
conn.create();
} else
{
x = conn.fileSize();
}
OutputStream ostream = conn.openOutputStream(x);
ostream.write(line.getBytes());
ostream.close();
conn.close();
}
catch (IOException e)
{
Helpers.alertMsg("Error writing to log file");
}
}
}