Package net.tomp2p.storage

Examples of net.tomp2p.storage.DataBuffer


    int size = 6;
    byte[] oldValue = "ZurichGenevaLuganoAA".getBytes();
    byte[] newValue = "AzurichGenevaLuganoAbbLuganoAAA".getBytes();
    List<Checksum> checksums = RSync.checksums(oldValue, size);
    List<Instruction> instructions = RSync.instructions(newValue, checksums, size);
    DataBuffer reconstructedValue = RSync.reconstruct(oldValue, instructions, size);
    Assert.assertArrayEquals(newValue, reconstructedValue.bytes());
  }
View Full Code Here


    int size = 6;
    byte[] oldValue = "ZurichGenevaLuganoAAA".getBytes();
    byte[] newValue = "AzurichGenevaLuganoAbbLuganoAA".getBytes();
    List<Checksum> checksums = RSync.checksums(oldValue, size);
    List<Instruction> instructions = RSync.instructions(newValue, checksums, size);
    DataBuffer reconstructedValue = RSync.reconstruct(oldValue, instructions, size);
    Assert.assertArrayEquals(newValue, reconstructedValue.bytes());
  }
View Full Code Here

    byte[] oldValue = "test0Test2test0Test4".getBytes();
    List<Checksum> checksums = RSync.checksums(oldValue, size);
    List<Instruction> instructions = RSync.instructions(newValue, checksums, size);

    Assert.assertEquals(4, instructions.size());
    DataBuffer reconstructedValue = RSync.reconstruct(oldValue, instructions, size);
    Assert.assertArrayEquals(newValue, reconstructedValue.bytes());
  }
View Full Code Here

    List<Checksum> checksums = RSync.checksums(oldValue.getBytes(), size);
    List<Instruction> instructions = RSync.instructions(newValue.getBytes(), checksums, size);
    System.out.println("checksums(" + checksums.size() + "): " + checksums);
    System.out.println("instructions(" + instructions.size() + "): " + instructions);

    DataBuffer reconstructedValue = RSync.reconstruct(oldValue.getBytes(), instructions, size);

    Assert.assertArrayEquals(newValue.getBytes(), reconstructedValue.bytes());
  }
View Full Code Here

TOP

Related Classes of net.tomp2p.storage.DataBuffer

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.