public class FilteredSharedChannelInputWrapper extends FilteredChannelInputWrapper implements FilteredSharedChannelInput
SharedChannelInput that adds
read filtering. Instances of this class can be safely used by
multiple concurrent processes.| Modifier and Type | Field and Description |
|---|---|
private java.lang.Object |
synchObject
The object used for synchronization by the methods here to protect the readers from each other
when manipulating the filters and reading data.
|
| Constructor and Description |
|---|
FilteredSharedChannelInputWrapper(SharedChannelInput in)
Constructs a new wrapper for the given channel input end.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addReadFilter(Filter filter)
Installs a read filter defining a transformation to be applied by the
read method of the
channel end. |
void |
addReadFilter(Filter filter,
int index)
Installs a read filter defining a transformation to be applied by the
read method of the
channel end at a specific index. |
Filter |
getReadFilter(int index)
Returns the read filter installed at the given index.
|
int |
getReadFilterCount()
Returns the number of read filters currently installed.
|
java.lang.Object |
read()
Reads a value from the channel.
|
void |
removeReadFilter(Filter filter)
Removes the first read filter (lowest index) matching the filter given as a parameter.
|
void |
removeReadFilter(int index)
Removes the read filter installed at the given index.
|
endRead, poison, startReadclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitendRead, startReadpoisonprivate java.lang.Object synchObject
public FilteredSharedChannelInputWrapper(SharedChannelInput in)
in - the existing channel end.public java.lang.Object read()
ChannelInputWrapperread in interface ChannelInputread in class FilteredChannelInputWrapperChannelInputpublic void addReadFilter(Filter filter)
ReadFilteredread method of the
channel end. The filter will be appended to the end of the current list, making it the last to
be applied.addReadFilter in interface ReadFilteredaddReadFilter in class FilteredChannelInputWrapperfilter - the filter to be installed; may not be null.public void addReadFilter(Filter filter, int index)
ReadFilteredread method of the
channel end at a specific index. If there is already a filter at that index position the existing
filters are shifted to make room. If the index is greater than the number of filters already
installed the filter is placed at the end.addReadFilter in interface ReadFilteredaddReadFilter in class FilteredChannelInputWrapperfilter - the filter to be installed; may not be null.index - the zero based index; may not be negative.public void removeReadFilter(Filter filter)
ReadFilteredr, will satisfy the condition r.equals (filter). The remaining
filters are shifted to close the gap in the index allocation.removeReadFilter in interface ReadFilteredremoveReadFilter in class FilteredChannelInputWrapperfilter - the filter to be removed; may not be null.public void removeReadFilter(int index)
ReadFilteredremoveReadFilter in interface ReadFilteredremoveReadFilter in class FilteredChannelInputWrapperindex - zero-based index of the filter to be removed.public Filter getReadFilter(int index)
ReadFilteredgetReadFilter in interface ReadFilteredgetReadFilter in class FilteredChannelInputWrapperindex - zero-based index of the filter to return.public int getReadFilterCount()
ReadFilteredgetReadFilterCount in interface ReadFilteredgetReadFilterCount in class FilteredChannelInputWrapper