/// <summary> /// Create a new SegmentFetcher to use the Face. /// </summary> /// /// <param name="face">This calls face.expressInterest to fetch more segments.</param> /// <param name="verifySegment">and call onError.onError with ErrorCode.SEGMENT_VERIFICATION_FAILED.</param> /// <param name="onComplete">content of all the segments.</param> /// <param name="onError"></param> private SegmentFetcher(Face face, SegmentFetcher.VerifySegment verifySegment, SegmentFetcher.OnComplete onComplete, SegmentFetcher.OnError onError) { this.contentParts_ = new ArrayList(); face_ = face; verifySegment_ = verifySegment; onComplete_ = onComplete; onError_ = onError; }
/// <summary> /// Initiate segment fetching. For more details, see the documentation for /// the class. /// </summary> /// /// <param name="face">This calls face.expressInterest to fetch more segments.</param> /// <param name="baseInterest">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.</param> /// <param name="verifySegment">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.</param> /// <param name="onComplete">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.</param> /// <param name="onError">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.</param> public static void fetch(Face face, Interest baseInterest, SegmentFetcher.VerifySegment verifySegment, SegmentFetcher.OnComplete onComplete, SegmentFetcher.OnError onError) { new SegmentFetcher(face, null, verifySegment, onComplete, onError) .fetchFirstSegment(baseInterest); }
/// <summary> /// Create a new SegmentFetcher to use the Face. See the static fetch method /// for details. If validatorKeyChain is not null, use it and ignore /// verifySegment. After creating the SegmentFetcher, call fetchFirstSegment. /// </summary> /// /// <param name="face">This calls face.expressInterest to fetch more segments.</param> /// <param name="validatorKeyChain"></param> /// <param name="verifySegment">and call onError.onError with ErrorCode.SEGMENT_VERIFICATION_FAILED.</param> /// <param name="onComplete">content of all the segments.</param> /// <param name="onError"></param> private SegmentFetcher(Face face, KeyChain validatorKeyChain, SegmentFetcher.VerifySegment verifySegment, SegmentFetcher.OnComplete onComplete, SegmentFetcher.OnError onError) { this.contentParts_ = new ArrayList(); face_ = face; validatorKeyChain_ = validatorKeyChain; verifySegment_ = verifySegment; onComplete_ = onComplete; onError_ = onError; }