Package freenet.keys

Examples of freenet.keys.FreenetURI


       
        byte[] buf = new byte[32];
        random.nextBytes(buf);
        String keyName = HexUtil.bytesToHex(buf);
       
        FreenetURI testKey;
        ClientKey insertKey;
        ClientKey fetchKey;
        ClientKeyBlock block;
       
        if(isSSK) {
          testKey = new FreenetURI("KSK", keyName);
         
          insertKey = InsertableClientSSK.create(testKey);
          fetchKey = ClientKSK.create(testKey);
         
          block = ((InsertableClientSSK)insertKey).encode(new ArrayBucket(buf), false, false, (short)-1, buf.length, random, COMPRESSOR_TYPE.DEFAULT_COMPRESSORDESCRIPTOR, false);
View Full Code Here


        }
        os.close();

        // Insert it to the established node.
        System.out.println("Inserting test data to an established node.");
        FreenetURI uri = insertData(dataFile);

        // Bootstrap a second node.
        secondInnerDir.mkdir();
        fis = new FileInputStream(seednodes);
        FileUtil.writeTo(fis, new File(secondInnerDir, "seednodes.fref"));
View Full Code Here

             System.err.println("Insert failed");
             System.exit(EXIT_INSERT_FAILED);
           }
           if(name.equals("PutSuccessful")) {
                 long endInsertTime = System.currentTimeMillis();
             FreenetURI uri = new FreenetURI(fs.get("URI"));
                 System.out.println("RESULT: Insert took "+(endInsertTime-startInsertTime)+"ms ("+TimeUtil.formatTime(endInsertTime-startInsertTime)+") to "+uri+" .");
             sockOS.close();
             sockIS.close();
             sock.close();
             return uri;
View Full Code Here

      StringBuilder sb = new StringBuilder();
      sb.append(TimeUtil.formatTime(diff, 2));
      row.addChild("td", sb.toString());
      row.addChild("td", Short.toString(request.getPriorityClass()));
      row.addChild("td", client==null ? "?" : Boolean.toString(client.realTimeFlag()));
      FreenetURI uri = request.getURI(); // getURI() sometimes returns null, eg for ClientPutters
      row.addChild("td", uri == null ? "null" : uri.toString());
    }
  }
View Full Code Here

    return sanitizeURI(null, key, false, options);
  }

  public static FreenetURI sanitizeURI(List<String> errors, String key, boolean breakOnErrors, Options... options) throws MalformedURLException {
    if (key == null) throw new NullPointerException();
    FreenetURI uri = new FreenetURI(key);
    return sanitizeURI(errors, uri, breakOnErrors, options);
  }
View Full Code Here

  }

  public static FreenetURI sanitizeURI(List<String> errors, FreenetURI key, boolean breakOnErrors, Options... options) throws MalformedURLException {
    if (key == null) throw new NullPointerException();

    FreenetURI tempURI = key;

Outer:  for (Options option: options) {
      switch (option) {
      case NOMETASTRINGS: {
        if (tempURI.hasMetaStrings()) {
          if (errors != null) {
            tempURI = tempURI.setMetaString(null);
            errors.add("URI did contain meta strings, removed it for you");
            if (breakOnErrors) break Outer;
          } else {
            throw new MalformedURLException("URIs with meta strings not supported");
          }
        }
        break;
      }
      case SSKFORUSK: {
        if (tempURI.isUSK()) {
          if (errors != null) {
            tempURI = tempURI.sskForUSK();
            errors.add("URI was an USK, converted it to SSK for you");
            if (breakOnErrors) break Outer;
          } else {
            throw new MalformedURLException("USK not supported, use underlying SSK instead.");
          }
View Full Code Here

    if((desc = isOfficialPlugin(pluginname)) != null) {
      return startPluginOfficial(pluginname, store, desc, false, false);
    }

    try {
      new FreenetURI(pluginname); // test for MalformedURLException
      return startPluginFreenet(pluginname, store);
    } catch(MalformedURLException e) {
      // not a freenet key
    }
View Full Code Here

    if(soFar == null) {
      soFar = new HashSet<FreenetURI>();
    }
    if(soFar.size() > maxArchiveLevels)
      throw new ArchiveFailureException(ArchiveFailureException.TOO_MANY_LEVELS);
    FreenetURI uri = key;
    if(!soFar.add(uri)) {
      throw new ArchiveFailureException(ArchiveFailureException.ARCHIVE_LOOP_DETECTED);
    }
  }
View Full Code Here

      addCurrentPluginDescription();
      return this;
    }

    public OfficialPluginBuilder loadedFrom(String uri) throws MalformedURLException {
      this.uri = new FreenetURI(uri);
      addCurrentPluginDescription();
      return this;
    }
View Full Code Here

   
    RandomAccessBucket b = new SimpleReadOnlyArrayBucket(buf);
   
    long number = crypto.myARKNumber;
    InsertableClientSSK ark = crypto.myARK;
    FreenetURI uri = ark.getInsertURI().setKeyType("USK").setSuggestedEdition(number);
   
    if(logMINOR) Logger.minor(this, "Inserting " + darknetOpennetString + " ARK: " + uri + "  contents:\n" + s);
   
    InsertContext ctx = node.clientCore.makeClient((short)0, true, false).getInsertContext(true);
    inserter = new ClientPutter(this, b, uri,
View Full Code Here

TOP

Related Classes of freenet.keys.FreenetURI

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.