public class Transforms extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Transforms.ByteBuffer2String
Convert ByteBuffers to Strings using the given CharSet
|
static class |
Transforms.Counter<T>
Count the number of items in the transfer.
|
static class |
Transforms.Log<T>
Log the toString() representation of transferred items to the given log.
|
static class |
Transforms.ObjectToString
Convert objects to Strings using .toString()
|
static class |
Transforms.ProgressLog<T>
Track progress of transfer by emitting a log message in given intervals.
|
static class |
Transforms.String2Bytes
Convert strings to bytes using the given CharSet
|
Constructor and Description |
---|
Transforms() |
Modifier and Type | Method and Description |
---|---|
static <T,Receiver2ThrowableType extends Throwable> |
filter(Specification<? super T> specification,
Output<T,Receiver2ThrowableType> output)
Filter items in a transfer by applying the given Specification to each item.
|
static <T,Receiver2ThrowableType extends Throwable> |
filteredMap(Specification<? super T> specification,
Function<? super T,? extends T> function,
Output<T,Receiver2ThrowableType> output)
Apply the given function to items in the transfer that match the given specification.
|
static <T,SenderThrowableType extends Throwable> |
lock(Lock lock,
Input<T,SenderThrowableType> input)
Wrapper for Outputs that uses a lock whenever a transfer is instantiated.
|
static <T,Receiver2ThrowableType extends Throwable> |
lock(Lock lock,
Output<T,Receiver2ThrowableType> output)
Wrapper for Outputs that uses a lock whenever a transfer is instantiated.
|
static <From,To,Receiver2ThrowableType extends Throwable> |
map(Function<? super From,? extends To> function,
Output<To,Receiver2ThrowableType> output)
Map items in a transfer from one type to another by applying the given function.
|
public static <T,Receiver2ThrowableType extends Throwable> Output<T,Receiver2ThrowableType> filter(Specification<? super T> specification, Output<T,Receiver2ThrowableType> output)
T
- The item typeReceiver2ThrowableType
- Exception type that might be thrown by the Receiver.specification
- The Specification defining the items to not filter away.output
- The Output instance to receive to result.public static <From,To,Receiver2ThrowableType extends Throwable> Output<From,Receiver2ThrowableType> map(Function<? super From,? extends To> function, Output<To,Receiver2ThrowableType> output)
From
- The type of the incoming items.To
- The type of the transformed items.Receiver2ThrowableType
- The exception type that the Receiver might throw.function
- The transformation function to apply to the streaming items.output
- The output to receive the transformed items.public static <T,Receiver2ThrowableType extends Throwable> Output<T,Receiver2ThrowableType> filteredMap(Specification<? super T> specification, Function<? super T,? extends T> function, Output<T,Receiver2ThrowableType> output)
T
- The item type. Items can not be transformed to a new type.Receiver2ThrowableType
- The exception that the Receiver might throw.specification
- The Specification defining which items should be transformed.function
- The transformation function.output
- The Output that will receive the resulting items.public static <T,Receiver2ThrowableType extends Throwable> Output<T,Receiver2ThrowableType> lock(Lock lock, Output<T,Receiver2ThrowableType> output)
T
- The Item typeReceiver2ThrowableType
- The Exception type that the Receiver might throw.lock
- the lock to be used for transfersoutput
- output to be wrappedpublic static <T,SenderThrowableType extends Throwable> Input<T,SenderThrowableType> lock(Lock lock, Input<T,SenderThrowableType> input)
T
- The item type.SenderThrowableType
- The Exception type that the Sender might throw.lock
- the lock to be used for transfersinput
- input to be wrapped