Package freenet.client

Examples of freenet.client.FetchResult


              throw new FetchException(FetchExceptionMode.NOT_ENOUGH_DISK_SPACE);
          } catch (IOException e) {
            throw new FetchException(FetchExceptionMode.BUCKET_ERROR);
          }
          // Return the data
          onSuccess(new FetchResult(clientMetadata, out), context);
         
          return;
        } else {
          if(logMINOR) Logger.minor(this, "Fetching archive (thisKey="+thisKey+ ')');
          // Metadata cannot contain pointers to files which don't exist.
          // We enforce this in ArchiveHandler.
          // Therefore, the archive needs to be fetched.
          final boolean persistent = this.persistent;
          fetchArchive(true, archiveMetadata, filename, new ArchiveExtractCallback() {
                        private static final long serialVersionUID = 1L;
                        @Override
            public void gotBucket(Bucket data, ClientContext context) {
              if(logMINOR) Logger.minor(this, "Returning data");
              // Because this will be processed immediately, and because the callback uses a StreamGenerator,
              // we can simply pass in the output bucket, even if it is not persistent.
              // If we ever change it so a StreamGenerator can be saved, we'll have to copy here.
              // Transient buckets should throw if attempted to store.
              onSuccess(new FetchResult(clientMetadata, data), context);
            }
            @Override
            public void notInArchive(ClientContext context) {
              onFailure(new FetchException(FetchExceptionMode.NOT_IN_ARCHIVE), false, context);
            }
View Full Code Here


   * @param uri
   *            The URI to fetch
   * @return The result of the fetch, or {@code null} if an error occured
   */
  public Fetched fetchUri(FreenetURI uri) {
    FetchResult fetchResult = null;
    FreenetURI currentUri = new FreenetURI(uri);
    while (true) {
      try {
        fetchResult = client.fetch(currentUri);
        return new Fetched(currentUri, fetchResult);
View Full Code Here

TOP

Related Classes of freenet.client.FetchResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.