|
JBoss Remoting 3.1.0.Beta1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jboss.remoting3.stream.Streams
public final class Streams

Handy utility methods for stream types.
| Method Summary | ||
|---|---|---|
static
|
getCheckedObjectSink(ObjectSink<T> delegate,
Class<? extends T> clazz)
Get an object sink that checks the type of each accepted instance. |
|
static
|
getCollection(C newCollection,
ObjectSource<T> objectSource)
Populate a new collection from an object source. |
|
static
|
getCollectionObjectSink(Collection<T> target)
Get an object sink that appends to a collection. |
|
static
|
getCollectionObjectSource(Collection<T> collection)
Get an object source which reads from a collection. |
|
static
|
getEnumerationObjectSource(Enumeration<T> enumeration)
Get an object source that reads from an enumeration. |
|
static
|
getFutureCollection(Executor executor,
C newCollection,
ObjectSource<T> objectSource)
Populate a new collection from an object source asynchronously. |
|
static
|
getFutureMap(Executor executor,
M newMap,
ObjectSource<org.jboss.marshalling.Pair<K,V>> objectSource)
Populate a new map from an object source asynchronously. |
|
static
|
getIteratorObjectSource(Iterator<T> iterator)
Get an object source that reads from an iterator. |
|
static
|
getMap(M newMap,
ObjectSource<org.jboss.marshalling.Pair<K,V>> objectSource)
Populate a new map from an object source. |
|
static
|
getMapEntryIteratorObjectSource(Iterator<Map.Entry<K,V>> iterator)
Get an object source that reads from an iterator over map entries. |
|
static
|
getMapObjectSink(Map<K,V> target)
Get an object sink that appends to a map. |
|
static
|
getMapObjectSource(Map<K,V> map)
Get an object source that reads from a map. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static <T> ObjectSink<T> getCollectionObjectSink(Collection<T> target)
T - the collection object typetarget - the target collection
public static <T> ObjectSource<T> getIteratorObjectSource(Iterator<T> iterator)
T - the iterator object typeiterator - the iterater to read from
public static <T> ObjectSource<T> getCollectionObjectSource(Collection<T> collection)
T - the collection member typecollection - the collection to read from
public static <K,V> ObjectSink<org.jboss.marshalling.Pair<K,V>> getMapObjectSink(Map<K,V> target)
K - the key typeV - the value typetarget - the target map
public static <T> ObjectSink<T> getCheckedObjectSink(ObjectSink<T> delegate,
Class<? extends T> clazz)
delegate - the object sink to delegate toclazz - the class to check for
public static <K,V> ObjectSource<org.jboss.marshalling.Pair<K,V>> getMapEntryIteratorObjectSource(Iterator<Map.Entry<K,V>> iterator)
K - the key typeV - the value typeiterator - the iterator object type
public static <K,V> ObjectSource<org.jboss.marshalling.Pair<K,V>> getMapObjectSource(Map<K,V> map)
K - the key typeV - the value typemap - the map
public static <C extends Collection<T>,T> C getCollection(C newCollection,
ObjectSource<T> objectSource)
throws IOException
An example usage which meets this requirement would be:
final List<Foo> fooList = getCollection(new ArrayList<Foo>(), fooSource);
C - the collection typeT - the collection value typenewCollection - the new collection to populateobjectSource - the object source to fill the collection from
IOException - if an error occurs
public static <M extends Map<K,V>,K,V> M getMap(M newMap,
ObjectSource<org.jboss.marshalling.Pair<K,V>> objectSource)
throws IOException
An example usage which meets this requirement would be:
final Map<Foo, Bar> fooBarMap = getMap(new HashMap<Foo, Bar>(), fooBarSource);
M - the map typeK - the map key typeV - the map value typenewMap - the new map to populateobjectSource - the object source to fill the map from
IOException - if an error occurs
public static <C extends Collection<T>,T> org.jboss.xnio.IoFuture<? extends C> getFutureCollection(Executor executor,
C newCollection,
ObjectSource<T> objectSource)
An example usage which meets this requirement would be:
final IoFuture<? extends List<Foo>> futureFooList = getFutureCollection(executor, new ArrayList<Foo>(), fooSource);
C - the collection typeT - the collection value typeexecutor - the executor in which to run asynchronous tasksnewCollection - the new collection to populateobjectSource - the object source to fill the collection from
IOException - if an error occurs
public static <M extends Map<K,V>,K,V> org.jboss.xnio.IoFuture<? extends M> getFutureMap(Executor executor,
M newMap,
ObjectSource<org.jboss.marshalling.Pair<K,V>> objectSource)
An example usage which meets this requirement would be:
final IoFuture<? extends Map<Foo, Bar>> futureFooBarMap = getFutureMap(executor, new HashMap<Foo, Bar>(), fooBarSource);
M - the map typeK - the map key typeV - the map value typenewMap - the new map to populateobjectSource - the object source to fill the map from
public static <T> ObjectSource<T> getEnumerationObjectSource(Enumeration<T> enumeration)
T - the enumeration object typeenumeration - the enumeration to read from
|
JBoss Remoting 3.1.0.Beta1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||