Sha256: f862e3090fbe684e41ca1d865e0d309338c63b3d26fff0b5fcc4201ccf38df0a
Contents?: true
Size: 1.15 KB
Versions: 155
Compression:
Stored size: 1.15 KB
Contents
package org.embulk.spi.util; import java.util.List; import java.util.ArrayList; import java.util.Iterator; import org.embulk.spi.Buffer; import org.embulk.spi.FileInput; public class ListFileInput implements FileInput { private Iterator<? extends Iterable<Buffer>> files; private Iterator<Buffer> currentBuffers; public ListFileInput(Iterable<? extends Iterable<Buffer>> files) { this.files = files.iterator(); } public boolean nextFile() { if (!files.hasNext()) { return false; } currentBuffers = files.next().iterator(); return true; } public Buffer poll() { if (currentBuffers == null) { throw new IllegalStateException("FileInput.nextFile is not called"); } if (!currentBuffers.hasNext()) { return null; } return currentBuffers.next(); } public void close() { do { while (true) { Buffer b = poll(); if (b == null) { break; } b.release(); } } while (nextFile()); } }
Version data entries
155 entries across 155 versions & 1 rubygems