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

📄 readfile.java

📁 完成“快速拼写检查程序”的分析、设计和实现过程。 快速拼写检查程序基本功能说明如下: 1.进行拼写检查的文件以文本文件形式存储于外存上; 2.只检查文件中英文单词的拼写错误; 3.单词是用字母(a…z
💻 JAVA
字号:
import java.io.*;

public class ReadFile{
	Word w;
	Data d;
	Interpunction i;
	public ReadFile(File F1)throws IOException{
		try{
			if(!F1.exists())throw new FileExistError();
			if(!F1.isFile())throw new IsNotFile();
			if(!F1.canRead())throw new CanNotRead();
			FileInputStream read=null;
			int i;
			char a;
			String s=new String("");
			try {
				 read=new FileInputStream(F1);
				 while((i=read.read())!=-1){
				 	 s+=(char)i;	
				 	}
				 this.w=new Word(s);
				 this.d=new Data(s);
				 this.i=new Interpunction(s);	
				}
			finally{
				 	if(read!=null)try{read.close();}catch(IOException e){;}
				 	}	
			}
		  catch(FileExistError e1){
			 System.out.println(e1.toString());
			}
		  catch(IsNotFile e2){
		  	 System.out.println(e2.toString());
		  	}
		  catch(CanNotRead e3){
		  	 System.out.println(e3.toString());
		  	}
		}
	}
	
class FileExistError extends Exception{
	public FileExistError(){
	     super();
		}
	public String toString(){
		return "源文件不存在";
		}	
	}
	
class IsNotFile	extends Exception{
	public IsNotFile(){
		super();
		}
	public String toString(){
		return "源不是文件名";
		}			
	}
	
class CanNotRead extends Exception{
	public CanNotRead(){
		super();
		}
	public String toString(){
		return "源文件不能读";
		}	
	}	
		

⌨️ 快捷键说明

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