欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
基于Lucene的Mp3檢索器
基于apache Lucene的mp3搜索器
前些日子找機器上的一首老歌時(shí),費了些周折,后想到既然這些mp3有自己的標簽信息,為何不利用起來(lái)呢?筆者就嘗試用Lucene實(shí)現,分兩部分,Mp3Indexer.java是創(chuàng )建索引的,mp3search.jsp是搜索mp3的頁(yè)面。
下面是Mp3Indexer.java的代碼。
package mp3indexer;
import java.io.*;
import java.text.*;
import java.util.*;

import org.apache.lucene.analysis.cjk.*;
import org.apache.lucene.document.*;
import org.apache.lucene.index.*;

public class Mp3Indexer
{
 public final static String mp3Path="d:\\mp3";//mp3所在目錄
 public final static String indexPath="c:\\mp3Indexer";//索引存放目錄
 public static void main(String[] args) throws ClassNotFoundException, IOException{
  try {
   IndexWriter writer = new IndexWriter(indexPath, new CJKAnalyzer(), true);
   indexMp3s(writer, new File(mp3Path));

   System.out.println("優(yōu)化中....");
   writer.optimize();
   writer.close();

  } catch (Exception e) {
   System.out.println(e.getMessage());
  }
}

public static void indexMp3s(IndexWriter writer, File file) throws Exception {
 if (file.isDirectory()) {
  String[] files = file.list();
  for (int i = 0; i < files.length; i++) {
   indexMp3s(writer, new File(file, files[i]));
  }
 }
 else if (file.getPath().endsWith(".mp3")) { //只對 MP3 文件做索引
 System.out.print("正在處理文件:" + file + " ....");
 // Add mp3 file ....
 Document doc = new Document();
 doc.add(Field.Text("name", file.getName())); //索引文件名
 doc.add(Field.UnIndexed("modified", DateFormat.getDateTimeInstance().format(new Date(file.lastModified())))); //索引最后修改時(shí)間
 doc.add(Field.Text("size",""+NumberFormat.getNumberInstance().format(file.length()/1048576.0)+"MB")); //索引最后修改時(shí)間

 FileReader fReader = new FileReader(file);
 java.io.RandomAccessFile r=new RandomAccessFile(file,"r");
 r.seek(file.length()-128);
 byte[] bt=new byte[127];
 r.read(bt);
 String labelInfo=new String(bt,"GB2312");
 System.out.println(labelInfo);

 if (labelInfo.startsWith("TAG")) {
  doc.add(Field.Text("comment", labelInfo));
 }
 System.out.println("[處理完成]");

 r.close();
 fReader.close();
 writer.addDocument(doc);
 } //end else if
}

} //end class

本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
Lucene版Hello world(世界,你好)
用Lucene檢索數據庫
lucene多種搜索方式詳解例子
[原創(chuàng )]全文搜索引擎Lucene學(xué)習筆記(頁(yè) 1) - 『 編程設計 』 - 青韶論壇 湘...
lucene爬數據庫中的數據無(wú)非也是查詢(xún)數據。所有我們用lucene搜索數據主要有下面幾個(gè)步驟
Lucene 全文檢索實(shí)踐
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久