Search in sources :

Example 1 with BundleWriter

use of de.lmu.ifi.dbs.elki.datasource.bundle.BundleWriter in project elki by elki-project.

the class ConvertToBundleApplication method run.

@Override
public void run() {
    if (LOG.isVerbose()) {
        LOG.verbose("Loading data.");
    }
    MultipleObjectsBundle bundle = input.loadData();
    if (LOG.isVerbose()) {
        LOG.verbose("Serializing to output file: " + outfile.toString());
    }
    // TODO: make configurable?
    BundleWriter writer = new BundleWriter();
    try {
        FileOutputStream fos = new FileOutputStream(outfile);
        FileChannel channel = fos.getChannel();
        writer.writeBundleStream(bundle.asStream(), channel);
        channel.close();
        fos.close();
    } catch (IOException e) {
        LOG.exception("IO Error", e);
    }
}
Also used : FileChannel(java.nio.channels.FileChannel) FileOutputStream(java.io.FileOutputStream) MultipleObjectsBundle(de.lmu.ifi.dbs.elki.datasource.bundle.MultipleObjectsBundle) BundleWriter(de.lmu.ifi.dbs.elki.datasource.bundle.BundleWriter) IOException(java.io.IOException)

Aggregations

BundleWriter (de.lmu.ifi.dbs.elki.datasource.bundle.BundleWriter)1 MultipleObjectsBundle (de.lmu.ifi.dbs.elki.datasource.bundle.MultipleObjectsBundle)1 FileOutputStream (java.io.FileOutputStream)1 IOException (java.io.IOException)1 FileChannel (java.nio.channels.FileChannel)1