⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index2.java

📁 利用开源词典star-dict编写的一个小词典程序,使用方法仿照金山词霸
💻 JAVA
字号:
import java.io.*;

//用以生成索引的索引!

public class Index2 {

	public static void main(String[] args) throws Exception
	{
		 File f2 = new File ("stardict.idx");
		 RandomAccessFile idx=new RandomAccessFile(f2,"r");
		 
		 File f1 = new File ("idxidx.idx");
		 RandomAccessFile Fout=new RandomAccessFile(f1,"rw");
		 
		 byte []attempt =new byte [50];
		 int i;
		 int place = 0;
		 byte az = 65;
		 while(true)
		{
			i = -1;
			do
			{
				i++;
				attempt[i] = idx.readByte();	
			}while(attempt[i] > 0 );
			
			idx.skipBytes(8);
			
			if(attempt[0] ==az ||attempt[0] ==(az+32))
			{
				az++;
				//System.out.println(place-2);
				Fout.writeLong(place-2);
				
				
			}
			place++;
			
			if(idx.getFilePointer()>=idx.length())
			{
				
			break;
			}
			
		
		}
		Fout.writeLong(place-2);
		
		Fout.close();
	}	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -