Package freenet.support.io

Examples of freenet.support.io.NullBucket


    }

    byte[] compressedData = doCompress(uncompressedData);

    Bucket inBucket = new ArrayBucket(compressedData);
    NullBucket outBucket = new NullBucket();
    InputStream decompressorInput = null;
    OutputStream decompressorOutput = null;
    try {
      decompressorInput = inBucket.getInputStream();
      decompressorOutput = outBucket.getOutputStream();
      Compressor.COMPRESSOR_TYPE.GZIP.decompress(decompressorInput, decompressorOutput, 4096 + 10, 4096 + 20);
      decompressorInput.close();
      decompressorOutput.close();
    } catch (CompressionOutputSizeException e) {
      // expect this
      return;
    } finally {
      Closer.close(decompressorInput);
      Closer.close(decompressorOutput);
      inBucket.free();
      outBucket.free();
    }
    fail("did not throw expected CompressionOutputSizeException");
  }
View Full Code Here


    }

    byte[] compressedData = doCompress(uncompressedData);

    Bucket inBucket = new ArrayBucket(compressedData);
    NullBucket outBucket = new NullBucket();
    InputStream decompressorInput = null;
    OutputStream decompressorOutput = null;

    try {
      decompressorInput = inBucket.getInputStream();
      decompressorOutput = outBucket.getOutputStream();
      Compressor.COMPRESSOR_TYPE.LZMA_NEW.decompress(decompressorInput, decompressorOutput, 4096 + 10, 4096 + 20);
      decompressorInput.close();
      decompressorOutput.close();
    } catch (CompressionOutputSizeException e) {
      // expect this
      return;
    } finally {
      Closer.close(decompressorInput);
      Closer.close(decompressorOutput);
      inBucket.free();
      outBucket.free();
    }
    // TODO LOW codec doesn't actually enforce size limit
    //fail("did not throw expected CompressionOutputSizeException");
  }
View Full Code Here

  @Override
  public void prefetch(FreenetURI uri, long timeout, long maxSize, Set<String> allowedTypes, short prio) {
    FetchContext ctx = getFetchContext(maxSize);
    ctx.allowedMIMETypes = allowedTypes;
    final ClientGetter get = new ClientGetter(nullCallback, uri, ctx, prio, new NullBucket(), null, null);
    core.getTicker().queueTimedJob(new Runnable() {
      @Override
      public void run() {
        get.cancel(core.clientContext);
      }
View Full Code Here

     * This one could actually be rather large, since it includes the listing of
     * which blocks go in which cross-segments ...
     */
    private Bucket encodeCrossSegmentSettings(BucketFactory bf) throws IOException {
        if (crossSegments == null)
            return new NullBucket();
        Bucket bucket = bf.makeBucket(-1);
        OutputStream os = bucket.getOutputStream();
        OutputStream cos = checker.checksumWriterWithLength(os, new ArrayBucketFactory());
        DataOutputStream dos = new DataOutputStream(cos);
        for (SplitFileInserterCrossSegmentStorage segment : crossSegments) {
View Full Code Here

   * @param context
   */
  public void hintUpdate(USK usk, long edition, ClientContext context) {
    if(edition < lookupLatestSlot(usk)) return;
    FreenetURI uri = usk.copy(edition).getURI().sskForUSK();
    final ClientGetter get = new ClientGetter(new NullClientCallback(rcBulk), uri, new FetchContext(backgroundFetchContext, FetchContext.IDENTICAL_MASK), RequestStarter.UPDATE_PRIORITY_CLASS, new NullBucket(), null, null);
    try {
      get.start(context);
    } catch (FetchException e) {
      // Ignore
    }
View Full Code Here

      if(logMINOR) Logger.minor(this, "Ignoring hint because edition is "+uri.getSuggestedEdition()+" but latest is "+lookupLatestSlot(USK.create(uri)));
      return;
    }
    uri = uri.sskForUSK();
    if(logMINOR) Logger.minor(this, "Doing hint fetch for "+uri);
    final ClientGetter get = new ClientGetter(new NullClientCallback(rcBulk), uri, new FetchContext(backgroundFetchContext, FetchContext.IDENTICAL_MASK), priority, new NullBucket(), null, null);
    try {
      get.start(context);
    } catch (FetchException e) {
      if(logMINOR) Logger.minor(this, "Cannot start hint fetch for "+uri+" : "+e, e);
      // Ignore
View Full Code Here

            @Override
            public RequestClient getRequestClient() {
                return rcBulk;
            }
     
    }, uri, new FetchContext(backgroundFetchContext, FetchContext.IDENTICAL_MASK), priority, new NullBucket(), null, null);
    try {
      get.start(context);
    } catch (FetchException e) {
      if(logMINOR) Logger.minor(this, "Cannot start hint fetch for "+uri+" : "+e, e);
      if(e.isDataFound())
View Full Code Here

TOP

Related Classes of freenet.support.io.NullBucket

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.