当前位置: 首页>>代码示例>>Java>>正文


Java FileAccess类代码示例

本文整理汇总了Java中org.hsqldb.lib.FileAccess的典型用法代码示例。如果您正苦于以下问题:Java FileAccess类的具体用法?Java FileAccess怎么用?Java FileAccess使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FileAccess类属于org.hsqldb.lib包,在下文中一共展示了FileAccess类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: save

import org.hsqldb.lib.FileAccess; //导入依赖的package包/类
/**
     *  Saves the properties using JDK2 method if present, otherwise JDK1.
     */
    public void save(String fileString) throws Exception {

// [email protected]
        fa.createParentDirs(fileString);
        fa.removeElement(fileString);

        OutputStream        fos = fa.openOutputStreamElement(fileString);
        FileAccess.FileSync outDescriptor = fa.getFileSync(fos);
        String name = HsqlDatabaseProperties.PRODUCT_NAME + " "
                      + HsqlDatabaseProperties.THIS_FULL_VERSION;

        stringProps.store(fos, name);
        fos.flush();
        outDescriptor.sync();
        fos.close();

        outDescriptor = null;
        fos           = null;
    }
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:23,代码来源:HsqlProperties.java

示例2: restoreBackupIncremental

import org.hsqldb.lib.FileAccess; //导入依赖的package包/类
/**
 * Restores in from an incremental backup
 */
private boolean restoreBackupIncremental() {

    try {
        FileAccess fileAccess = database.logger.getFileAccess();

        if (fileAccess.isStreamElement(backupFileName)) {
            RAShadowFile.restoreFile(database, backupFileName,
                                     dataFileName);
            deleteFile(database, backupFileName);

            return true;
        }

        // this is an anomaly where no backup exists but .data file
        // modified flag has been set
        return false;
    } catch (Throwable e) {
        database.logger.logSevereEvent(
            "DataFileCache.restoreBackupIncremental", e);

        throw Error.error(ErrorCode.FILE_IO_ERROR, e);
    }
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:27,代码来源:DataFileCache.java

示例3: renameBackupFile

import org.hsqldb.lib.FileAccess; //导入依赖的package包/类
static void renameBackupFile(Database database, String backupFileName) {

        FileAccess fileAccess = database.logger.getFileAccess();

        if (database.logger.propIncrementBackup) {
            deleteFile(database, backupFileName);

            return;
        }

        if (fileAccess.isStreamElement(backupFileName
                                       + Logger.newFileExtension)) {
            deleteFile(database, backupFileName);
            fileAccess.renameElement(backupFileName + Logger.newFileExtension,
                                     backupFileName);
        }
    }
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:18,代码来源:DataFileCache.java

示例4: deleteFile

import org.hsqldb.lib.FileAccess; //导入依赖的package包/类
static void deleteFile(Database database, String fileName) {

        FileAccess fileAccess = database.logger.getFileAccess();

        // first attempt to delete
        fileAccess.removeElement(fileName);

        if (database.logger.isStoredFileAccess()) {
            return;
        }

        if (fileAccess.isStreamElement(fileName)) {
            database.logger.log.deleteOldDataFiles();
            fileAccess.removeElement(fileName);

            if (fileAccess.isStreamElement(fileName)) {
                String discardName = FileUtil.newDiscardFileName(fileName);

                fileAccess.renameElement(fileName, discardName);
            }
        }
    }
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:23,代码来源:DataFileCache.java

示例5: ScriptWriterBase

import org.hsqldb.lib.FileAccess; //导入依赖的package包/类
ScriptWriterBase(Database db, OutputStream outputStream,
                 FileAccess.FileSync descriptor,
                 boolean includeCachedData) {

    initBuffers();

    this.database          = db;
    this.includeCachedData = includeCachedData;
    this.includeIndexRoots = !includeCachedData;
    currentSession         = database.sessionManager.getSysSession();

    // start with neutral schema - no SET SCHEMA to log
    schemaToLog = currentSession.loggedSchema =
        currentSession.currentSchema;
    fileStreamOut = new BufferedOutputStream(outputStream, 1 << 14);
    outDescriptor = descriptor;
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:18,代码来源:ScriptWriterBase.java

示例6: save

import org.hsqldb.lib.FileAccess; //导入依赖的package包/类
/**
     *  Saves the properties using JDK2 method if present, otherwise JDK1.
     */
    public void save(String fileString) throws Exception {

// [email protected]
        fa.createParentDirs(fileString);

        OutputStream        fos = fa.openOutputStreamElement(fileString);
        FileAccess.FileSync outDescriptor = fa.getFileSync(fos);

        JavaSystem.saveProperties(
            stringProps,
            HsqlDatabaseProperties.PRODUCT_NAME + " "
            + HsqlDatabaseProperties.THIS_FULL_VERSION, fos);
        fos.flush();
        outDescriptor.sync();
        fos.close();

        return;
    }
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:22,代码来源:HsqlProperties.java

示例7: openFile

import org.hsqldb.lib.FileAccess; //导入依赖的package包/类
protected void openFile() {

        try {
            FileAccess           fa  = database.getFileAccess();
            java.io.OutputStream fos = fa.openOutputStreamElement(outFile);

            outDescriptor = fa.getFileSync(fos);
            fileStreamOut = new DeflaterOutputStream(fos,
                    new Deflater(Deflater.DEFAULT_COMPRESSION), bufferSize);
        } catch (IOException e) {
            throw Error.error(ErrorCode.FILE_IO_ERROR,
                              ErrorCode.M_Message_Pair, new Object[] {
                e.toString(), outFile
            });
        }
    }
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:17,代码来源:ScriptWriterZipped.java

示例8: openFile

import org.hsqldb.lib.FileAccess; //导入依赖的package包/类
/**
 *  File is opened in append mode although in current usage the file
 *  never pre-exists
 */
protected void openFile() {

    try {
        FileAccess   fa  = isDump ? FileUtil.getDefaultInstance()
                                  : database.getFileAccess();
        OutputStream fos = fa.openOutputStreamElement(outFile);

        outDescriptor = fa.getFileSync(fos);
        fileStreamOut = new BufferedOutputStream(fos, 2 << 12);
    } catch (IOException e) {
        throw Error.error(ErrorCode.FILE_IO_ERROR,
                          ErrorCode.M_Message_Pair, new Object[] {
            e.toString(), outFile
        });
    }
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:21,代码来源:ScriptWriterBase.java

示例9: save

import org.hsqldb.lib.FileAccess; //导入依赖的package包/类
/**
     *  Saves the properties using JDK2 method if present, otherwise JDK1.
     */
    public void save(String fileString) throws Exception {

// [email protected]
        fa.createParentDirs(fileString);

        OutputStream        fos = fa.openOutputStreamElement(fileString);
        FileAccess.FileSync outDescriptor = fa.getFileSync(fos);
        String name = HsqlDatabaseProperties.PRODUCT_NAME + " "
                      + HsqlDatabaseProperties.THIS_FULL_VERSION;

        stringProps.store(fos, name);
        fos.flush();
        outDescriptor.sync();
        fos.close();

        outDescriptor = null;
        fos           = null;
    }
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:22,代码来源:HsqlProperties.java

示例10: restoreBackupIncremental

import org.hsqldb.lib.FileAccess; //导入依赖的package包/类
/**
 * Restores in from an incremental backup
 */
static boolean restoreBackupIncremental(Database database,
        String dataFileName, String backupFileName) {

    try {
        FileAccess fileAccess = database.logger.getFileAccess();

        if (fileAccess.isStreamElement(backupFileName)) {
            RAShadowFile.restoreFile(database, backupFileName,
                                     dataFileName);
            deleteFile(database, backupFileName);

            return true;
        }

        return false;
    } catch (Throwable e) {
        database.logger.logSevereEvent(
            "DataFileCache.restoreBackupIncremental", e);

        throw Error.error(ErrorCode.FILE_IO_ERROR, e);
    }
}
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:26,代码来源:DataFileCache.java

示例11: deleteFile

import org.hsqldb.lib.FileAccess; //导入依赖的package包/类
static void deleteFile(Database database, String fileName) {

        FileAccess fileAccess = database.logger.getFileAccess();

        // first attemp to delete
        fileAccess.removeElement(fileName);

        if (database.logger.isStoredFileAccess()) {
            return;
        }

        if (fileAccess.isStreamElement(fileName)) {
            database.logger.log.deleteOldDataFiles();
            fileAccess.removeElement(fileName);

            if (fileAccess.isStreamElement(fileName)) {
                String discardName = FileUtil.newDiscardFileName(fileName);

                fileAccess.renameElement(fileName, discardName);
            }
        }
    }
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:23,代码来源:DataFileCache.java

示例12: openFile

import org.hsqldb.lib.FileAccess; //导入依赖的package包/类
protected void openFile() throws HsqlException {

        try {
            FileAccess           fa  = database.getFileAccess();
            java.io.OutputStream fos = fa.openOutputStreamElement(outFile);

            outDescriptor = fa.getFileSync(fos);
            fileStreamOut = new DeflaterOutputStream(fos,
                    new Deflater(Deflater.DEFAULT_COMPRESSION), bufferSize);
        } catch (IOException e) {
            throw Trace.error(Trace.FILE_IO_ERROR, Trace.Message_Pair,
                              new Object[] {
                e.toString(), outFile
            });
        }
    }
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:17,代码来源:ScriptWriterZipped.java

示例13: openFile

import org.hsqldb.lib.FileAccess; //导入依赖的package包/类
/**
 *  File is opened in append mode although in current usage the file
 *  never pre-exists
 */
protected void openFile() throws HsqlException {

    try {
        FileAccess   fa  = isDump ? FileUtil.getDefaultInstance()
                                  : database.getFileAccess();
        OutputStream fos = fa.openOutputStreamElement(outFile);

        outDescriptor = fa.getFileSync(fos);
        fileStreamOut = new BufferedOutputStream(fos, 2 << 12);
    } catch (IOException e) {
        throw Trace.error(Trace.FILE_IO_ERROR, Trace.Message_Pair,
                          new Object[] {
            e.toString(), outFile
        });
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:21,代码来源:ScriptWriterBase.java

示例14: save

import org.hsqldb.lib.FileAccess; //导入依赖的package包/类
/**
     *  Saves the properties using JDK2 method if present, otherwise JDK1.
     */
    public void save(String fileString) throws Exception {

// [email protected]
        fa.createParentDirs(fileString);

        OutputStream        fos = fa.openOutputStreamElement(fileString);
        FileAccess.FileSync outDescriptor = fa.getFileSync(fos);

        JavaSystem.saveProperties(
            stringProps,
            HsqlDatabaseProperties.PRODUCT_NAME + " "
            + HsqlDatabaseProperties.THIS_FULL_VERSION, fos);
        fos.flush();
        outDescriptor.sync();
        fos.close();

        outDescriptor = null;
        fos           = null;

        return;
    }
 
开发者ID:RabadanLab,项目名称:Pegasus,代码行数:25,代码来源:HsqlProperties.java

示例15: restoreBackup

import org.hsqldb.lib.FileAccess; //导入依赖的package包/类
/**
 * Restores a compressed backup or the .data file.
 */
private boolean restoreBackup() {

    // in case data file cannot be deleted, reset it
    deleteFile();

    try {
        FileAccess fa = database.logger.getFileAccess();

        if (fa.isStreamElement(backupFileName)) {
            FileArchiver.unarchive(backupFileName, dataFileName, fa,
                                   FileArchiver.COMPRESSION_ZIP);

            return true;
        }

        return false;
    } catch (Throwable t) {
        throw Error.error(t, ErrorCode.FILE_IO_ERROR,
                          ErrorCode.M_Message_Pair, new Object[] {
            t.toString(), backupFileName
        });
    }
}
 
开发者ID:RabadanLab,项目名称:Pegasus,代码行数:27,代码来源:DataFileCache.java


注:本文中的org.hsqldb.lib.FileAccess类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。