All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.embulk.parser.seqfile.column.simple.DoubleWritableColumn Maven / Gradle / Ivy

package org.embulk.parser.seqfile.column.simple;

import java.io.DataInput;
import java.io.IOException;

import org.apache.hadoop.io.DoubleWritable;
import org.embulk.parser.seqfile.SequenceFileParserPlugin.ColumnOptionTask;
import org.embulk.parser.seqfile.SequenceFileParserPlugin.PluginTask;
import org.embulk.parser.seqfile.column.AbstractDoubleWritableColumn;
import org.embulk.parser.seqfile.column.WritableColumn;
import org.embulk.spi.Column;
import org.embulk.spi.PageBuilder;

public class DoubleWritableColumn extends AbstractDoubleWritableColumn {

    private final DoubleWritable writableValue;

    public DoubleWritableColumn(PluginTask task, Column column, ColumnOptionTask option) {
        super(task, column, option);
        writableValue = new DoubleWritable();
    }

    public DoubleWritableColumn(WritableColumn from, DoubleWritable writableValue) {
        super(from.getPluginTask(), from.getColumn(), from.getColumnOption());
        this.writableValue = writableValue;
    }

    @Override
    public void readFields(DataInput in) throws IOException {
        writableValue.readFields(in);
    }

    @Override
    public void writeTo(PageBuilder pageBuilder) {
        double value = writableValue.get();
        writeTo(pageBuilder, false, value);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy