fileinode.java

来自「NAS文件器的模拟」· Java 代码 · 共 65 行

JAVA
65
字号
package fileSystem;

public class FileINode extends INode{
	private ClientID clientID;
	private String time_amend;
	int length_file;
	
	public FileINode (int iNode) {
		super(iNode);
		try{
			clientID = new ClientID(in.readInt(), in.readInt());
			time_amend = in.readUTF();
			length_file = in.readInt();
			in.close();
			try {				
				dataBlock = new DataBlock(VirtualData.getBlockInINode(iNode));
				int i = 2;
				int get = VirtualData.getBlockInINode(iNode, 2);
				while ( get != -1) {
					dataBlock.addDataBlock(get);
					i = i + 1;
					get =  VirtualData.getBlockInINode(iNode, i);
				}				
			}catch (Exception e) {
				dataBlock = null;
			}
		}catch (Exception e){
			
		}
	}
	
	public FileINode (int iNode, String otherName) {
		super(iNode);
		name = otherName;
		try{
			clientID = new ClientID(in.readInt(), in.readInt());
			time_amend = in.readUTF();
			length_file = in.readInt();
			in.close();			
		}catch (Exception e){
			
		}
	}
	
	public String getName() {
		return name;
	}
	
	public int getLength (){
		return length_file;
	}
	
	public String getCreatTime(){
		return time_creat;
	}
	
	public String getAccessTime(){
		return time_access;
	}
	
	public String getAmendTime(){
		return time_amend;
	}
}

⌨️ 快捷键说明

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