📄 fileaccesssecuritycheck.java
字号:
package net;
import java.io.*;
/**
* 在这里插入类型说明。
* 建立日期:(00-8-3 15:52:06)
* @程序设计者:
*/
public class FileAccessSecurityCheck extends SecurityManager{
private String password_for_read;
private String password_for_write;
/**
* FileAccessSecurityCheck 构造子注释。
*/
public FileAccessSecurityCheck(String password_for_read,String password_for_write) {
super();
this.password_for_read=password_for_read;
this.password_for_write=password_for_write;
}
/**
* 在这里插入方法说明。
* 建立日期:(00-8-3 15:59:10)
* @return boolean
*/
public void checkRead(String file) {
DataInputStream password_input_stream=new DataInputStream(System.in);
try{
System.out.println("password for reading:");
if (!(password_input_stream.readLine()).equals(password_for_read)){
throw new SecurityException();
}
}catch (IOException e){
//throw new SecurityException();
}
}
/**
* 在这里插入方法说明。
* 建立日期:(00-8-3 15:59:10)
* @return boolean
*/
public void checkWrite(String file){
DataInputStream password_input_stream=new DataInputStream(System.in);
try{
System.out.println("password for writing:");
if (!(password_input_stream.readLine()).equals(password_for_write)){
throw new SecurityException();
}
}catch (IOException e){
throw new SecurityException();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -