Search in sources :

Example 1 with FileAccess

use of org.hsqldb_voltpatches.lib.FileAccess in project voltdb by VoltDB.

the class ScriptWriterBase method openFile.

/**
     *  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 });
    }
}
Also used : FileAccess(org.hsqldb_voltpatches.lib.FileAccess) OutputStream(java.io.OutputStream) BufferedOutputStream(java.io.BufferedOutputStream) SchemaObject(org.hsqldb_voltpatches.SchemaObject) IOException(java.io.IOException) BufferedOutputStream(java.io.BufferedOutputStream)

Example 2 with FileAccess

use of org.hsqldb_voltpatches.lib.FileAccess in project voltdb by VoltDB.

the class ScriptWriterZipped method openFile.

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 });
    }
}
Also used : Deflater(java.util.zip.Deflater) FileAccess(org.hsqldb_voltpatches.lib.FileAccess) DeflaterOutputStream(java.util.zip.DeflaterOutputStream) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)2 FileAccess (org.hsqldb_voltpatches.lib.FileAccess)2 BufferedOutputStream (java.io.BufferedOutputStream)1 OutputStream (java.io.OutputStream)1 Deflater (java.util.zip.Deflater)1 DeflaterOutputStream (java.util.zip.DeflaterOutputStream)1 SchemaObject (org.hsqldb_voltpatches.SchemaObject)1