net.named_data.jndn.util
public class SegmentFetcher extends Object implements OnData, OnTimeout
| Modifier and Type | Class and Description |
|---|---|
static class |
SegmentFetcher.ErrorCode |
static interface |
SegmentFetcher.OnComplete |
static interface |
SegmentFetcher.OnError |
static interface |
SegmentFetcher.VerifySegment |
| Modifier and Type | Field and Description |
|---|---|
static SegmentFetcher.VerifySegment |
DontVerifySegment
DontVerifySegment may be used in fetch to skip validation of Data packets.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
fetch(Face face,
Interest baseInterest,
SegmentFetcher.VerifySegment verifySegment,
SegmentFetcher.OnComplete onComplete,
SegmentFetcher.OnError onError)
Initiate segment fetching.
|
void |
onData(Interest originalInterest,
Data data)
When a matching data packet is received, onData is called.
|
void |
onTimeout(Interest interest)
If the interest times out according to the interest lifetime, onTimeout is
called.
|
public static final SegmentFetcher.VerifySegment DontVerifySegment
public static void fetch(Face face, Interest baseInterest, SegmentFetcher.VerifySegment verifySegment, SegmentFetcher.OnComplete onComplete, SegmentFetcher.OnError onError)
face - This calls face.expressInterest to fetch more segments.baseInterest - An Interest for the initial segment of the requested
data, where baseInterest.getName() has the name prefix.
This interest may include a custom InterestLifetime and selectors that will
propagate to all subsequent Interests. The only exception is that the
initial Interest will be forced to include selectors "ChildSelector=1" and
"MustBeFresh=true" which will be turned off in subsequent Interests.verifySegment - When a Data packet is received this calls
verifySegment.verifySegment(data). If it returns false then abort fetching
and call onError.onError with ErrorCode.SEGMENT_VERIFICATION_FAILED. If
data validation is not required, use DontVerifySegment.
NOTE: The library will log any exceptions thrown by this callback, but for
better error handling the callback should catch and properly handle any
exceptions.onComplete - When all segments are received, call
onComplete.onComplete(content) where content is the concatenation of the
content of all the segments.
NOTE: The library will log any exceptions thrown by this callback, but for
better error handling the callback should catch and properly handle any
exceptions.onError - Call onError.onError(errorCode, message) for timeout or an
error processing segments.
NOTE: The library will log any exceptions thrown by this callback, but for
better error handling the callback should catch and properly handle any
exceptions.public void onData(Interest originalInterest, Data data)
OnDataCopyright © 2016. All rights reserved.