Examples of ArrayBucket


Examples of freenet.support.io.ArrayBucket

    return outBuf;
  }

  private byte[] doCompress(byte[] uncompressedData) throws IOException {
    Bucket inBucket = new ArrayBucket(uncompressedData);
    BucketFactory factory = new ArrayBucketFactory();
    Bucket outBucket = null;

    outBucket = Compressor.COMPRESSOR_TYPE.BZIP2.compress(inBucket, factory, 32768, 32768);
View Full Code Here

Examples of freenet.support.io.ArrayBucket

  }

  public void testCompressException() throws IOException {

    byte[] uncompressedData = UNCOMPRESSED_DATA_1.getBytes();
    Bucket inBucket = new ArrayBucket(uncompressedData);
    BucketFactory factory = new ArrayBucketFactory();

    try {
      Compressor.COMPRESSOR_TYPE.GZIP.compress(inBucket, factory, 32, 32);
    } catch (CompressionOutputSizeException e) {
View Full Code Here

Examples of freenet.support.io.ArrayBucket

      uncompressedData[i] = 1;
    }

    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

Examples of freenet.support.io.ArrayBucket

    return outBuf;
  }

  private byte[] doCompress(byte[] uncompressedData) throws IOException {
    Bucket inBucket = new ArrayBucket(uncompressedData);
    BucketFactory factory = new ArrayBucketFactory();
    Bucket outBucket = null;

    outBucket = Compressor.COMPRESSOR_TYPE.GZIP.compress(inBucket, factory, 32768, 32768);
View Full Code Here

Examples of freenet.support.io.ArrayBucket

  }

  public void testCompressException() throws IOException {

    byte[] uncompressedData = UNCOMPRESSED_DATA_1.getBytes();
    Bucket inBucket = new ArrayBucket(uncompressedData);
    BucketFactory factory = new ArrayBucketFactory();

    try {
      Compressor.COMPRESSOR_TYPE.LZMA_NEW.compress(inBucket, factory, 32, 32);
    } catch (CompressionOutputSizeException e) {
View Full Code Here

Examples of freenet.support.io.ArrayBucket

      uncompressedData[i] = 1;
    }

    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

Examples of freenet.support.io.ArrayBucket

    // TODO LOW codec doesn't actually enforce size limit
    //fail("did not throw expected CompressionOutputSizeException");
  }

  private byte[] doCompress(byte[] uncompressedData) throws IOException {
    Bucket inBucket = new ArrayBucket(uncompressedData);
    BucketFactory factory = new ArrayBucketFactory();
    Bucket outBucket = null;

    outBucket = Compressor.COMPRESSOR_TYPE.LZMA_NEW.compress(inBucket, factory, uncompressedData.length, uncompressedData.length * 2 + 64);

View Full Code Here

Examples of freenet.support.io.ArrayBucket

public class AEADStreamsTest extends TestCase {
   
    public void testSuccessfulRoundTrip() throws IOException {
        Random random = new Random(0x96231307);
        for(int i=0;i<10;i++) {
            ArrayBucket input = new ArrayBucket();
            BucketTools.fill(input, random, 65536);
            checkSuccessfulRoundTrip(16, random, input, new ArrayBucket(), new ArrayBucket());
            checkSuccessfulRoundTrip(24, random, input, new ArrayBucket(), new ArrayBucket());
            checkSuccessfulRoundTrip(32, random, input, new ArrayBucket(), new ArrayBucket());
        }
    }
View Full Code Here

Examples of freenet.support.io.ArrayBucket

    }
   
    public void testCorruptedRoundTrip() throws IOException {
        Random random = new Random(0x96231307); // Same seed as first test, intentionally.
        for(int i=0;i<10;i++) {
            ArrayBucket input = new ArrayBucket();
            BucketTools.fill(input, random, 65536);
            checkFailedCorruptedRoundTrip(16, random, input, new ArrayBucket(), new ArrayBucket());
            checkFailedCorruptedRoundTrip(24, random, input, new ArrayBucket(), new ArrayBucket());
            checkFailedCorruptedRoundTrip(32, random, input, new ArrayBucket(), new ArrayBucket());
        }
    }
View Full Code Here

Examples of freenet.support.io.ArrayBucket

        }
    }
   
    public void testTruncatedReadsWritesRoundTrip() throws IOException {
        Random random = new Random(0x49ee92f5);
        ArrayBucket input = new ArrayBucket();
        BucketTools.fill(input, random, 512*1024);
        checkSuccessfulRoundTripRandomSplits(16, random, input, new ArrayBucket(), new ArrayBucket());
        checkSuccessfulRoundTripRandomSplits(24, random, input, new ArrayBucket(), new ArrayBucket());
        checkSuccessfulRoundTripRandomSplits(32, random, input, new ArrayBucket(), new ArrayBucket());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.