findsection.java

来自「这是用java编写的加密与解密程序」· Java 代码 · 共 62 行

JAVA
62
字号


import java.io.*;



public class FindSection 
{
	
	public int section = 0;
	public int endsec = 0;
	public FindSection(String path)
	{
		try
		{
			DataInputStream in = new DataInputStream(new BufferedInputStream((new FileInputStream(path))));
			BufferedReader bf = new BufferedReader(new InputStreamReader(in));
			
			
//			String dd = bf.readLine();
			
			
			int secNo = 0;
			int pos = 0;
			String ss = "";
			
			
			
			
			while(!(ss.equals("EOF")))
			{
				ss = bf.readLine();
				pos++;
				
				if(ss.equals("SECTION"))
				{
					secNo++;
				}
				if(secNo == 5)
				{
					section = pos;
					
					while(!ss.equals("ENDSEC"))
					{
						ss = bf.readLine();
						pos++;
					}
					
					endsec = pos;
					ss = "EOF";
				}
			}
		}
		catch(IOException e)
		{
			System.out.print(e);
		}
	}
	
	
}

⌨️ 快捷键说明

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