fatrootentry.java

来自「纯java操作系统jnode,安装简单和操作简单的个人使用的Java操作系统」· Java 代码 · 共 103 行

JAVA
103
字号
/*
 * $Id: FatRootEntry.java,v 1.4 2003/12/21 07:55:39 epr Exp $
 */
package org.jnode.fs.fat;

import java.io.IOException;

import org.jnode.fs.FSAccessRights;
import org.jnode.fs.FSDirectory;
import org.jnode.fs.FSEntry;
import org.jnode.fs.FSFile;

/**
 * @author epr
 */
public class FatRootEntry extends FatObject implements FSEntry {

	/** The actual root directory */
	private final FatDirectory rootDir;

	public FatRootEntry(FatDirectory rootDir) {
		super(rootDir.getFatFileSystem());
		this.rootDir = rootDir;
	}

	/**
	 * Gets the name of this entry.
	 */
	public String getName() {
		return "";
	}

	/**
	 * Gets the directory this entry is a part of.
	 */
	public FSDirectory getParent() {
		return null;
	}

	/**
	 * Gets the last modification time of this entry.
	 */

	public long getLastModified() {
		return System.currentTimeMillis();
	}

	/**
	 * Is this entry refering to a file?
	 */
	public boolean isFile() {
		return false;
	}

	/**
	 * Is this entry refering to a (sub-)directory?
	 */
	public boolean isDirectory() {
		return true;
	}

	/**
	 * Sets the name of this entry.
	 */
	public void setName(String newName) throws IOException {
		throw new IOException("Cannot change name of root directory");
	}

	/**
	 * Sets the last modification time of this entry.
	 * 
	 * @throws IOException
	 */
	public void setLastModified(long lastModified) throws IOException {
		throw new IOException("Cannot change last modified of root directory");
	}

	/**
	 * Gets the file this entry refers to. This method can only be called if
	 * <code>isFile</code> returns true.
	 */
	public FSFile getFile() throws IOException {
		throw new IOException("Not a file");
	}

	/**
	 * Gets the directory this entry refers to. This method can only be called
	 * if <code>isDirectory</code> returns true.
	 */
	public FSDirectory getDirectory() {
		return rootDir;
	}

	/**
	 * Gets the accessrights for this entry.
	 * 
	 * @throws IOException
	 */
	public FSAccessRights getAccessRights() throws IOException {
		throw new IOException("Not implemented yet");
	}
}

⌨️ 快捷键说明

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