Search in sources :

Example 1 with SnappyOutputStream

use of org.xerial.snappy.SnappyOutputStream in project voltdb by VoltDB.

the class OnDemandBinaryLogger method getStream.

private static Stuff getStream(final String name) throws IOException {
    Stuff s = m_files.get(name);
    if (s == null) {
        File f = new VoltFile(path, name);
        f.delete();
        RandomAccessFile ras = new RandomAccessFile(f, "rw");
        ras.seek(8);
        SnappyOutputStream sos = new SnappyOutputStream(new FileOutputStream(ras.getFD()));
        DataOutputStream dos = new DataOutputStream(sos);
        s = new Stuff();
        s.dos = dos;
        s.count = ras.getChannel().map(MapMode.READ_WRITE, 0, 8);
        s.count.order(ByteOrder.nativeOrder());
        m_files.put(name, s);
    }
    return s;
}
Also used : RandomAccessFile(java.io.RandomAccessFile) VoltFile(org.voltdb.utils.VoltFile) DataOutputStream(java.io.DataOutputStream) FileOutputStream(java.io.FileOutputStream) RandomAccessFile(java.io.RandomAccessFile) File(java.io.File) VoltFile(org.voltdb.utils.VoltFile) SnappyOutputStream(org.xerial.snappy.SnappyOutputStream)

Aggregations

DataOutputStream (java.io.DataOutputStream)1 File (java.io.File)1 FileOutputStream (java.io.FileOutputStream)1 RandomAccessFile (java.io.RandomAccessFile)1 VoltFile (org.voltdb.utils.VoltFile)1 SnappyOutputStream (org.xerial.snappy.SnappyOutputStream)1