本文整理汇总了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;
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
}
示例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;
}
示例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;
}
示例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
});
}
}
示例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
});
}
}
示例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;
}
示例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);
}
}
示例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);
}
}
}
示例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
});
}
}
示例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
});
}
}
示例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;
}
示例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
});
}
}