Package org.syncany.chunk

Examples of org.syncany.chunk.Chunker


  @Test
  public void testStringSerialization() {
    final int CHUNK_SIZE = 512*1024;
   
    Chunker chunker = new FixedChunker(CHUNK_SIZE);
    assertEquals("Other toString() result expected.", "Fixed-"+CHUNK_SIZE+"-"+FixedChunker.DEFAULT_DIGEST_ALG, chunker.toString());
  }
View Full Code Here


    File inputRandom5MBFile = TestFileUtil.createRandomFileInDirectory(tempDir, TOTAL_FILE_SIZE);
   
    File outputCopyOfRandom5MBFile = TestFileUtil.getRandomFilenameInDirectory(tempDir);
    FileOutputStream outputCopyOfRandom5MBFileOutputStream = new FileOutputStream(outputCopyOfRandom5MBFile);
   
    Chunker chunker = new FixedChunker(EXACT_CHUNK_SIZE, FixedChunker.DEFAULT_DIGEST_ALG);
   
    // Create chunks
    int actualChunkCount = 0;
    Enumeration<Chunk> chunkEnumeration = chunker.createChunks(inputRandom5MBFile);
    Chunk lastChunk = null;
   
    while (chunkEnumeration.hasMoreElements()) {
      actualChunkCount++;
      lastChunk = chunkEnumeration.nextElement();
View Full Code Here

    final int TOTAL_FILE_SIZE = 5*1024;
    final int EXACT_CHUNK_SIZE = 512*1024;
   
    // Setup       
    File inputFile = TestFileUtil.createRandomFileInDirectory(tempDir, TOTAL_FILE_SIZE);   
    Chunker chunker = new FixedChunker(EXACT_CHUNK_SIZE);
   
    // Create chunks
    Enumeration<Chunk> chunkEnumeration = chunker.createChunks(inputFile);
   
    while (chunkEnumeration.hasMoreElements()) {
      chunkEnumeration.nextElement();
    }
   
View Full Code Here

  @Test
  public void testStringSerialization() {
    final int CHUNK_SIZE = 512*1024;
   
    Chunker chunker = new TttdChunker(CHUNK_SIZE);
    assertEquals("Other toString() result expected.", "TTTD-"+CHUNK_SIZE+"-"+TttdChunker.DEFAULT_DIGEST_ALG+"-"+TttdChunker.DEFAULT_FINGERPRINT_ALG, chunker.toString());
  }
View Full Code Here

    File inputRandom5MBFile = TestFileUtil.createRandomFileInDirectory(tempDir, TOTAL_FILE_SIZE);
   
    File outputCopyOfRandom5MBFile = TestFileUtil.getRandomFilenameInDirectory(tempDir);
    FileOutputStream outputCopyOfRandom5MBFileOutputStream = new FileOutputStream(outputCopyOfRandom5MBFile);
   
    Chunker chunker = new TttdChunker(AVG_CHUNK_SIZE);
   
    // Create chunks
    Enumeration<Chunk> chunkEnumeration = chunker.createChunks(inputRandom5MBFile);
    Chunk lastChunk = null;
   
    while (chunkEnumeration.hasMoreElements()) {
      lastChunk = chunkEnumeration.nextElement();
     
View Full Code Here

    final int TOTAL_FILE_SIZE = 5*1024;
    final int CHUNK_SIZE = 512*1024;
   
    // Setup       
    File inputFile = TestFileUtil.createRandomFileInDirectory(tempDir, TOTAL_FILE_SIZE);   
    Chunker chunker = new TttdChunker(CHUNK_SIZE);
   
    // Create chunks
    Enumeration<Chunk> chunkEnumeration = chunker.createChunks(inputFile);
   
    while (chunkEnumeration.hasMoreElements()) {
      chunkEnumeration.nextElement();
    }
   
View Full Code Here

      FileUtils.touch(reconstructedFileInCache)
      return reconstructedFileInCache;
    }
       
    // Create non-empty file
    Chunker chunker = config.getChunker();
    MultiChunker multiChunker = config.getMultiChunker();
   
    FileOutputStream reconstructedFileOutputStream = new FileOutputStream(reconstructedFileInCache);   
    MessageDigest reconstructedFileChecksum = MessageDigest.getInstance(chunker.getChecksumAlgorithm());
   
    if (fileContent != null) { // File can be empty!
      Collection<ChunkChecksum> fileChunks = fileContent.getChunks();

      for (ChunkChecksum chunkChecksum : fileChunks) {
View Full Code Here

TOP

Related Classes of org.syncany.chunk.Chunker

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.