JAVA¶ÁÈ¡PPTÎļþ
import java.io.InputStream;
import org.apache.lucene.document.Document;
import org.apache.poi.hslf.HSLFSlideShow;
import org.apache.poi.hslf.model.TextRun;
import org.apache.poi.hslf.model.Slide;
import org.apache.poi.hslf.usermodel.SlideShow;
public Document getDocument(Index index, String url, String title, InputStream is)
throws DocCenterException {
StringBuffer content = new StringBuffer("");
try{
SlideShow ss = new SlideShow(new HSLFSlideShow(is));//is ΪÎļþµÄInputStream£¬½¨Á¢SlideShow
Slide[] slides = ss.getSlides();//»ñµÃÿһÕÅ»ÃµÆÆ¬
for(int i=0;i<slides.length;i++){
TextRun[] t = slides[i].getTextRuns();//ΪÁËÈ¡µÃ»ÃµÆÆ¬µÄÎÄ×ÖÄÚÈÝ£¬½¨Á¢TextRun
for(int j=0;j<t.length;j++){
content.append(t[j].getText());//ÕâÀï»á½«ÎÄ×ÖÄÚÈݼӵ½contentÖÐÈ¥
}
content.append(slides[i].getTitle());
}
index.AddIndex(url, title, content.toString());
}catch(Exception ex){
System.out.println(ex.toString());
}
return null;
}
Ïà¹ØÎĵµ£º
Javaʱ¼äÉèΪ¶þÊ®ËÄÐ¡Ê±ÖÆºÍÊ®¶þÐ¡Ê±ÖÆµÄÇø±ð£º
1£© ¶þÊ®ËÄÐ¡Ê±ÖÆ£º “yyyy-MM-dd HH:mm:ss”
2£©Ê®¶þÐ¡Ê±ÖÆ£º “"yyyy-MM-dd hh:mm:ss"”
Àý£¨¶þÊ®ËÄÐ¡Ê±ÖÆ£©£º
private String getTime(){
Calendar now;
SimpleDateFormat fmt;
now = Calendar.getInstance();
fmt = new S ......
4¡¢ TimerºÍTimerTaskµÄʹÓÃ
TimerÊÇÒ»ÖÖ¶¨Ê±Æ÷¹¤¾ß£¬ÓÃÀ´ÔÚÒ»¸öºǫ́Ï̼߳ƻ®Ö´ÐÐÖ¸¶¨ÈÎÎñ£¬ÕâЩÈÎÎñ¿ÉÒÔ±»Ö´ÐÐÒ»´Î£¬Ò²¿ÉÒÔ±»¶¨ÆÚÖ´ÐС£Ã¿¸ö Timer ¶ÔÏó¶ÔÓ¦Ò»¸öºǫ́Ị̈߳¬Ë³ÐòµØÖ´ÐÐËùÓмÆÊ±Æ÷ÈÎÎñ¡£Èç¹ûÍê³Éij¸ö¼ÆÊ±Æ÷ÈÎÎñµÄʱ¼äÌ«³¤£¬ÄÇôËü»á“¶ÀÕ¼”¼ÆÊ±Æ÷µÄÈ ......
½ñÌìÓÃÁËÏÂjava.lang.ProcessÀֻ࣬Êdzõ²½µÄѧϰ£¬²¢Ã»ÓÐÉîÈëʵ¼ù£¬ÒòΪ¸Ð¾õËüµÄÓÃ;²¢²»ÊǺܴó£¬Å¼¶û²Å¿ÉÄÜÓÃÉÏ£¬Èç¹ûÒª¾³£Ê¹ÓÃËüµÄÈË¿ÉÒÔ×ÔÐвο¼JDkÎĵµ¡£
¶ÔProcessÀàµÄ¼òҪ˵Ã÷£º
ProcessÀàÊÇÒ»¸ö³éÏóÀ࣬·½·¨¶¼ÊdzéÏóµÄ£¬Ëü·â×°ÁËÒ»¸ö½ø³Ì£¬Ò²¾ÍÊÇÒ»¸ö ......