package ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
public class Demo {
public static void main(String[] args) throws Exception {
testjson();
testconverter();
testprintf();
new Thread(new Runnable() {
public void run() {
testwatchdir();
}
}).start();
}
private static void testwatchdir() {
DirWatcher dirWatcher = new DirWatcher("d:/java", "*.txt");
(new DirWatcherListener() {
public void onChange(File file, event) {
(() + ":" + ());
}
});
(10000);
}
private static void testprintf() {
("%+i", 173);
("%04d", 1);
("%f", 1.7);
("%1.1f", 1.7);
("%.4e", 100.1e10);
("%G", 1.1e13);
("%l", true);
("%L", 123);
("%b", 13);
("%,b", -13);
("%#X", 173);
("%,x", -1);
(("%s %s", new String[]{"one", "two"}));
}
private static void testconverter() {
TypeConverter tc = (String.class);
(((123)));
(("1232"));
((1));
}
private static void testpage() {
HttpBrowser browser = new HttpBrowser();
HttpRequest request = ("");
(request);
String page = ();
(page);
HttpRequest newRequest = ("");
HttpResponse response=(newRequest);
}
private static void testhttp() {
HttpRequest request = new HttpRequest();
("GET")
.protocol("http")
.host("")
.port(80)
.path("");
(().bodyText());
}
private static void testget() {
HttpResponse response = ("").send();
(());
Map<String, String[]> headers = ();
for (<String, String[]> entry : ()) {
String key = ();
String[] value = ();
(key + "=");
for (String string : value) {
(string);
}
();
}
}
private static void testjson() {
Book book = new Book();
(120);
("namexxx");
("java android");
String json = new JsonSerializer().include("authors").serialize(book);
(json);
Book book2 = new JsonParser().parse(json, Book.class);
(book2);
}
private static void sendemail() throws Exception {
Email email = new Email();
("infoxxx@");
("igorxxxx@");
("test7");
EmailMessage textMessage = new EmailMessage("Hello!",
MimeTypes.MIME_TEXT_PLAIN);
(textMessage);
EmailMessage htmlMessage = new EmailMessage(
"<html><META http-equiv=Content-Type content=\"text/html; charset=utf-8\">"
+ "<body><h1>Hey!</h1><img src='cid:'><h2>Hay!</h2></body></html>",
MimeTypes.MIME_TEXT_HTML);
(htmlMessage);
EmailAttachment embeddedAttachment = new ByteArrayAttachment(FileUtil
.readBytes("/"), "image/png", "", "");
(htmlMessage);
(embeddedAttachment);
EmailAttachment attachment = new FileAttachment(new File("/"),
"", "image/jpeg");
(attachment);
}
}