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

📄 ifile.java

📁 这个是perst-269.zip下面的SOURCECODE,和大家分享了。
💻 JAVA
字号:
package org.garret.perst;

/**
 * Interface of file.
 * Programmer can provide its own impleentation of this interface, adding such features
 * as support of flash cards, encrypted files,...
 * Implentation of this interface should throw StorageError exception in case of failure
 */
public interface IFile { 
    /**
     * Write data to the file
     * @param pos offset in the file
     * @param buf array with data to be writter (size is always equal to database page size)
     */
    void write(long pos, byte[] buf);

    /**
     * Read data from the file
     * @param pos offset in the file
     * @param buf array to receive readen data (size is always equal to database page size)
     * @return number of bytes actually readen
     */
    int read(long pos, byte[] buf);

    /**
     * Flush all fiels changes to the disk
     */
    void sync();
        
    /**
     * Try lock file
     * @param shared if lock is shared
     * @return <code>true</code> if file was successfully locked or locking in not implemented,
     * <code>false</code> if file is locked by some other applciation     
     */
    boolean tryLock(boolean shared);

    /**
     * Lock file
     * @param shared if lock is shared
     */
    void lock(boolean shared);

    /**
     * Unlock file
     */
    void unlock();

    /**
     * Close file
     */
    void close();

    /**
     * Length of the file
     */
    long length();
}

⌨️ 快捷键说明

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