vmfilehandle.java

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

JAVA
75
字号
/*
 * $Id: VMFileHandle.java,v 1.1 2003/11/25 11:41:56 epr Exp $
 */
package java.io;


/**
 * A FileHandle represents a single, opened file for a single principal.
 * @author epr
 */
public interface VMFileHandle {

	/**
	 * Gets the length (in bytes) of this file
	 * @return long
	 */
	public long getLength();
	
	/**
	 * Sets the length of this file.
	 * @param length
	 * @throws IOException
	 */
	public void setLength(long length)
	throws IOException;

	/**
	 * Gets the current position in the file
	 * @return long
	 */
	public long getPosition();
	
	/**
	 * Sets the position in the file.
	 * @param position
	 * @throws IOException
	 */
	public void setPosition(long position)
	throws IOException;

	/**
	 * Read <code>len</code> bytes from the given position.
	 * The read data is read fom this file starting at offset <code>fileOffset</code>
	 * and stored in <code>dest</code> starting at offset <code>ofs</code>.
	 * @param dest
	 * @param off
	 * @param len
	 * @throws IOException
	 */	
	public void read(byte[] dest, int off, int len)
	throws IOException;
	
	/**
	 * Write <code>len</code> bytes to the given position. 
	 * The data is read from <code>src</code> starting at offset
	 * <code>ofs</code> and written to this file starting at offset <code>fileOffset</code>.
	 * @param src
	 * @param off
	 * @param len
	 * @throws IOException
	 */	
	public void write(byte[] src, int off, int len)
	throws IOException;

	/**
	 * Close this file.
	 */
	public void close();
	
	/**
	 * Has this handle been closed?
	 */
	public boolean isClosed();
}

⌨️ 快捷键说明

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