public class OfflineIterable<T,U extends T> extends Object implements Iterable<U>, SafelyCloseable
OfflineIterator
on this object that returns all the elements added so far. Note that the returned iterator caches the current number of elements,
so each iterator will return just the elements added at the time of its creation.
Warning: The store object provided at construction time is shared by all iterators.
Both OfflineIterable
and OfflineIterator
are SafelyCloseable
(the latter will
close its input stream when hasNext()
returns false), but for better resource management you should close them after usage.
Modifier and Type | Class and Description |
---|---|
static class |
OfflineIterable.OfflineIterator<A,B extends A>
An iterator returned by an
OfflineIterable . |
static interface |
OfflineIterable.Serializer<A,B extends A>
Determines a strategy to serialize and deserialize elements.
|
Modifier and Type | Field and Description |
---|---|
static long |
serialVersionUID |
Constructor and Description |
---|
OfflineIterable(OfflineIterable.Serializer<? super T,U> serializer,
U store)
Creates an offline iterable with given serializer.
|
Modifier and Type | Method and Description |
---|---|
void |
add(T x)
Adds a new element at the end of this iterable.
|
void |
addAll(Iterable<T> it)
Adds all the elements of the given iterable at the end of this iterable.
|
void |
close() |
protected void |
finalize() |
OfflineIterable.OfflineIterator<T,U> |
iterator() |
long |
length()
Returns the number of elements added so far.
|
int |
size()
Returns the number of elements added so far, unless it is too big to fit in an integer (in which case this method will throw an
exception).
|
public static final long serialVersionUID
public OfflineIterable(OfflineIterable.Serializer<? super T,U> serializer, U store) throws IOException
serializer
- the serializer to be used.store
- an object that is (re)used by the iterator(s) iterating on this iterable.IOException
public void add(T x) throws IOException
x
- the element to be added.IOException
public void addAll(Iterable<T> it) throws IOException
it
- the iterable producing the elements to be added.IOException
public OfflineIterable.OfflineIterator<T,U> iterator()
public void close()
close
in interface Closeable
close
in interface AutoCloseable
protected void finalize() throws Throwable
public int size()
public long length()
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.