Sha256: e9c8c38cd746ea2195b72e52f763ce5245b90eb9ced8ad6043d95b698df5c0e4
Contents?: true
Size: 1.69 KB
Versions: 84
Compression:
Stored size: 1.69 KB
Contents
package org.embulk.standards; import java.io.InputStream; import java.io.IOException; import java.util.zip.GZIPInputStream; import org.embulk.config.Task; import org.embulk.config.TaskSource; import org.embulk.config.ConfigSource; import org.embulk.config.ConfigInject; import org.embulk.spi.DecoderPlugin; import org.embulk.spi.BufferAllocator; import org.embulk.spi.FileInput; import org.embulk.spi.util.FileInputInputStream; import org.embulk.spi.util.InputStreamFileInput; public class GzipFileDecoderPlugin implements DecoderPlugin { public interface PluginTask extends Task { @ConfigInject 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) { PluginTask task = taskSource.loadTask(PluginTask.class); final FileInputInputStream files = new FileInputInputStream(fileInput); return new InputStreamFileInput( task.getBufferAllocator(), new InputStreamFileInput.Provider() { public InputStream openNext() throws IOException { if (!files.nextFile()) { return null; } return new GZIPInputStream(files, 8*1024); } public void close() throws IOException { files.close(); } }); } }
Version data entries
84 entries across 84 versions & 1 rubygems