| Modifier and Type | Class and Description |
|---|---|
| public static class | OrderedFlow.
A subclass of |
| public static class | OrderedFlow.
A subclass of |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv long | |
| private final ToIntFunction | |
| pack-priv long | |
| private final ToLongFunction | |
| private final ConcurrentSkipListSet |
| Access | Constructor and Description |
|---|---|
| public | OrderedFlow(Comparator<T>
A comparator to order the frames according to their position in
the ordered flow. Typically, this will compare the
frame's offset: the frame with the smaller offset will be sorted
before the frame with the greater offset comparator, ToLongFunction<T> A method reference that returns the position of the frame in the
flow. For instance, this would be position, ToIntFunction<T> CryptoFrame::offset if <T> is CryptoFrame, or
StreamFrame::offset if <T>
is StreamFrameA method reference that returns the number of bytes in the frame data.
This is used to compute the expected position of the next
frame in the flow. For instance, this would be length)CryptoFrame::length if <T> is CryptoFrame, or
StreamFrame::dataLength if <T>
is StreamFrameConstructs a new instance of ordered flow to reorder frames in a given flow. |
| Modifier and Type | Method and Description |
|---|---|
| public long | |
| public void | |
| private long | Returns: the amount of dropped datathe offset below which frames should be dropped offset)Drop all frames in the buffer whose position is strictly below offset. |
| private void | |
| public boolean | |
| public long | |
| private T | |
| public T | Returns: the head of the queue if it is at the current offset, ornullRemoves and return the head of the queue if it is at the current offset. |
| private T | |
| public T | Returns: the next frame in the flow, ornull if it is not
available yet.a frame that was received frame)Receives a new frame. |
| public int | |
| protected abstract T | Returns: a slice of the given framethe frame to slice frame, long the new frame offset offset, int the new frame length length)Returns a slice of the given frame. |
| buffered | back to summary |
|---|---|
| pack-priv long buffered | |
| length | back to summary |
|---|---|
| private final ToIntFunction<T> length | |
| offset | back to summary |
|---|---|
| pack-priv long offset | |
| position | back to summary |
|---|---|
| private final ToLongFunction<T> position | |
| queue | back to summary |
|---|---|
| private final ConcurrentSkipListSet<T> queue | |
| OrderedFlow | back to summary |
|---|---|
| public OrderedFlow(Comparator<T> comparator, ToLongFunction<T> position, ToIntFunction<T> length) Constructs a new instance of ordered flow to reorder frames in a given flow.
| |
| buffered | back to summary |
|---|---|
| public long buffered() Returns the number of bytes buffered.
| |
| clear | back to summary |
|---|---|
| public void clear() Drops all buffered frames | |
| dropuntil | back to summary |
|---|---|
| private long dropuntil(long offset) Drop all frames in the buffer whose position is strictly below offset.
| |
| enqueue | back to summary |
|---|---|
| private void enqueue(T frame, long pos, int length, long after) | |
| isEmpty | back to summary |
|---|---|
| public boolean isEmpty() Returns true if there are no buffered frames.
| |
| offset | back to summary |
|---|---|
| public long offset() Returns the current offset of this buffer.
| |
| peekFirst | back to summary |
|---|---|
| private T peekFirst() | |
| poll | back to summary |
|---|---|
| public T poll() Removes and return the head of the queue if it is at the current offset. Otherwise, returns null.
| |
| poll | back to summary |
|---|---|
| private T poll(long offset) Pretends to receive the head of the queue, if it is at the provided offset
| |
| receive | back to summary |
|---|---|
| public T receive(T frame) Receives a new frame. If the frame is below the current offset the frame is dropped. If it is above the current offset, it is queued. If the frame is exactly at the current offset, it is returned.
| |
| size | back to summary |
|---|---|
| public int size() Returns the number of buffered frames.
| |
| slice | back to summary |
|---|---|
| protected abstract T slice(T frame, long offset, int length) Returns a slice of the given frame.
| |
OrderedFlow used to reorder instances of
CryptoFrame.
| Access | Constructor and Description |
|---|---|
| public | CryptoDataFlow()
Constructs a new instance of |
| Modifier and Type | Method and Description |
|---|---|
| protected CryptoFrame | slice(CryptoFrame frame, long offset, int length)
Implements abstract jdk. Returns a slice of the given frame. |
| CryptoDataFlow | back to summary |
|---|---|
| public CryptoDataFlow() Constructs a new instance of | |
| slice | back to summary |
|---|---|
| protected CryptoFrame slice(CryptoFrame frame, long offset, int length) Implements abstract jdk. Doc from jdk. Returns a slice of the given frame.
| |
OrderedFlow used to reorder instances of
StreamFrame.
| Access | Constructor and Description |
|---|---|
| public | StreamDataFlow()
Constructs a new instance of |
| Modifier and Type | Method and Description |
|---|---|
| protected StreamFrame | slice(StreamFrame frame, long offset, int length)
Implements abstract jdk. Returns a slice of the given frame. |
| StreamDataFlow | back to summary |
|---|---|
| public StreamDataFlow() Constructs a new instance of | |
| slice | back to summary |
|---|---|
| protected StreamFrame slice(StreamFrame frame, long offset, int length) Implements abstract jdk. Doc from jdk. Returns a slice of the given frame.
| |