Package org.apache.iceberg.io
Interface CloseableIterable<T>
-
- All Superinterfaces:
java.lang.AutoCloseable,java.io.Closeable,java.lang.Iterable<T>
- All Known Implementing Classes:
AvroIterable,CloseableIterable.ConcatCloseableIterable,ManifestReader,ParallelIterable,ParquetIterable,ParquetReader,SortedMerge,VectorizedParquetReader,VectorizedTableScanIterable
public interface CloseableIterable<T> extends java.lang.Iterable<T>, java.io.Closeable
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classCloseableIterable.ConcatCloseableIterable<E>
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static <E> CloseableIterable<E>combine(java.lang.Iterable<E> iterable, java.io.Closeable closeable)static <E> CloseableIterable<E>concat(java.lang.Iterable<CloseableIterable<E>> iterable)static <T> CloseableIterable<T>count(Counter counter, CloseableIterable<T> iterable)Counts the number of elements in the givenCloseableIterableby incrementing theCounterinstance for eachIterator.next()call.static <E> CloseableIterable<E>empty()static <E> CloseableIterable<E>filter(CloseableIterable<E> iterable, java.util.function.Predicate<E> pred)static <E> CloseableIterable<E>filter(Counter skipCounter, CloseableIterable<E> iterable, java.util.function.Predicate<E> pred)Filters the givenCloseableIterableand counts the number of elements that do not match the predicate by incrementing theCounter.CloseableIterator<T>iterator()Returns a closeable iterator over elements of typeT.static <I,O>
CloseableIterable<O>transform(CloseableIterable<I> iterable, java.util.function.Function<I,O> transform)static <E> CloseableIterable<E>whenComplete(CloseableIterable<E> iterable, java.lang.Runnable onCompletionRunnable)Will run the given runnable whenCloseable.close()has been called.static <E> CloseableIterable<E>withNoopClose(E entry)static <E> CloseableIterable<E>withNoopClose(java.lang.Iterable<E> iterable)
-
-
-
Method Detail
-
iterator
CloseableIterator<T> iterator()
Returns a closeable iterator over elements of typeT.- Specified by:
iteratorin interfacejava.lang.Iterable<T>- Returns:
- an
CloseableIterator.
-
withNoopClose
static <E> CloseableIterable<E> withNoopClose(E entry)
-
withNoopClose
static <E> CloseableIterable<E> withNoopClose(java.lang.Iterable<E> iterable)
-
empty
static <E> CloseableIterable<E> empty()
-
combine
static <E> CloseableIterable<E> combine(java.lang.Iterable<E> iterable, java.io.Closeable closeable)
-
whenComplete
static <E> CloseableIterable<E> whenComplete(CloseableIterable<E> iterable, java.lang.Runnable onCompletionRunnable)
Will run the given runnable whenCloseable.close()has been called.- Type Parameters:
E- The type of the underlying iterable- Parameters:
iterable- The underlyingCloseableIterableto iterate overonCompletionRunnable- The runnable to run after the underlying iterable was closed- Returns:
- A new
CloseableIterablewhere the runnable will be executed as the final step afterCloseable.close()has been called
-
filter
static <E> CloseableIterable<E> filter(CloseableIterable<E> iterable, java.util.function.Predicate<E> pred)
-
filter
static <E> CloseableIterable<E> filter(Counter skipCounter, CloseableIterable<E> iterable, java.util.function.Predicate<E> pred)
Filters the givenCloseableIterableand counts the number of elements that do not match the predicate by incrementing theCounter.- Type Parameters:
E- The underlying type to be iterated.- Parameters:
skipCounter- TheCounterinstance to increment on each skipped item during filtering.iterable- The underlyingCloseableIterableto filter.- Returns:
- A filtered
CloseableIterablewhere the given skipCounter is incremented whenever the predicate does not match.
-
count
static <T> CloseableIterable<T> count(Counter counter, CloseableIterable<T> iterable)
Counts the number of elements in the givenCloseableIterableby incrementing theCounterinstance for eachIterator.next()call.- Type Parameters:
T- The underlying type to be iterated.- Parameters:
counter- TheCounterinstance to increment on eachIterator.next()call.iterable- The underlyingCloseableIterableto count- Returns:
- A
CloseableIterablethat increments the given counter on eachIterator.next()call.
-
transform
static <I,O> CloseableIterable<O> transform(CloseableIterable<I> iterable, java.util.function.Function<I,O> transform)
-
concat
static <E> CloseableIterable<E> concat(java.lang.Iterable<CloseableIterable<E>> iterable)
-
-