Sha256: 7844774da836eb56985ec37dde997119908822add617128e0e094047992485a7

Contents?: true

Size: 1.6 KB

Versions: 2

Compression:

Stored size: 1.6 KB

Contents

package org.embulk.decoder.unzip;

import org.embulk.config.Config;
import org.embulk.config.ConfigDefault;
import org.embulk.config.ConfigInject;
import org.embulk.config.ConfigSource;
import org.embulk.config.Task;
import org.embulk.config.TaskSource;
import org.embulk.spi.BufferAllocator;
import org.embulk.spi.DecoderPlugin;
import org.embulk.spi.FileInput;
import org.embulk.spi.util.FileInputInputStream;

public class UnzipDecoderPlugin
        implements DecoderPlugin
{
    public interface PluginTask
            extends Task
    {
        @Config("format")
        @ConfigDefault("\"\"")
        public String getFormat();

        @Config("decompress_concatenated")
        @ConfigDefault("true")
        public boolean getDecompressConcatenated();

        @Config("match_name")
        @ConfigDefault("\"\"")
        public String getMatchName();

//        @Config("skip_on_error")
//        @ConfigDefault("true")
//        public boolean skipOnError();

        @ConfigInject
        public BufferAllocator getBufferAllocator();
    }

    @Override
    public void transaction(ConfigSource config, DecoderPlugin.Control control)
    {
        PluginTask task = config.loadConfig(PluginTask.class);

        control.run(task.dump());
    }

    @Override
    public FileInput open(TaskSource taskSource, FileInput fileInput)
    {
        final PluginTask task = taskSource.loadTask(PluginTask.class);

        final FileInputInputStream files = new FileInputInputStream(fileInput);
        return new CommonsCompressFileInput(task.getBufferAllocator(),
                new CommonsCompressProvider(task, files));
    }

}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
embulk-decoder-unzip-0.1.4 src/main/java/org/embulk/decoder/unzip/UnzipDecoderPlugin.java
embulk-decoder-unzip-0.1.3 src/main/java/org/embulk/decoder/unzip/UnzipDecoderPlugin.java