@@ -0,0 +1,2089 @@
+import java.io.BufferedOutputStream;%0Aimport java.io.File;%0Aimport java.io.FileOutputStream;%0Aimport java.io.IOException;%0Aimport java.text.DateFormat;%0Aimport java.text.SimpleDateFormat;%0Aimport java.util.Calendar;%0Aimport java.util.List;%0Aimport java.util.TimeZone;%0A%0Aimport project.fantalk.api.fanfou.FanfouService;%0Aimport project.fantalk.api.fanfou.domain.Status;%0A%0Apublic class FanFouMessagePersistence %7B%0A%09private final static String UserName = %22%22;%0A%09private final static String PassWord = %22%22;%0A%0A%09public static void main(String%5B%5D args) throws IOException %7B%0A%09%09FanFouMessagePersistence fouFouMessageService = new FanFouMessagePersistence();%0A%09%09int pageNo = 1;%0A%09%09DateFormat dateFormat = new SimpleDateFormat(%22yyyy-MM-dd HH:mm:ss%22);%0A%09%09StringBuffer sb = new StringBuffer();%0A%09%09FanfouService fanfouService = new FanfouService(UserName, PassWord);%0A%09%09List%3CStatus%3E statusList = fanfouService.timeline(pageNo);%0A%09%09while (statusList != null && !statusList.isEmpty()) %7B%0A%09%09%09for (Status status : statusList) %7B%0A%09%09%09%09String message = %22%5Cn%22%0A%09%09%09%09%09%09+ dateFormat.format(status.getCreatedAt()) + %22    %22%0A%09%09%09%09%09%09+ status.getText() + %22   By %22 + status.getSource()%0A%09%09%09%09%09%09+ %22%5Cn%22;%0A%09%09%09%09sb.append(message);%0A%09%09%09%7D%0A%09%09%09statusList = fanfouService.timeline(++pageNo);%0A%09%09%7D%0A%09%09fouFouMessageService.saveFanFouMessage(sb.toString(), null);%0A%09%7D%0A%0A%09private void saveFanFouMessage(String str, String fileName)%0A%09%09%09throws IOException %7B%0A%09%09if (fileName == null %7C%7C %22%22.equals(fileName)) %7B%0A%09%09%09fileName = getFileName() + %22.txt%22;%0A%09%09%7D%0A%09%09File file = new File(fileName);%0A%09%09if (file.exists()) %7B%0A%09%09%09file.delete();%0A%09%09%7D%0A%09%09FileOutputStream fileOutPutStream = new FileOutputStream(file);%0A%09%09BufferedOutputStream bfOutPutStream = new BufferedOutputStream(%0A%09%09%09%09fileOutPutStream);%0A%09%09bfOutPutStream.write(str.getBytes());%0A%09%09bfOutPutStream.flush();%0A%09%09System.out.println(file.getAbsolutePath());%0A%09%09bfOutPutStream.close();%0A%09%09fileOutPutStream.close();%0A%09%7D%0A%0A%09private String getFileName() %7B%0A%09%09Calendar date = Calendar.getInstance(TimeZone.getTimeZone(%22GMT+08:00%22));%0A%09%09DateFormat dateFormat = new SimpleDateFormat(%22yyyy-MM-dd%22);%0A%09%09return dateFormat.format(date.getTime());%0A%09%7D%0A%7D%0A

add backup message