Package io.crums.util.mrkl
Class FixedLeafBuilder
java.lang.Object
io.crums.util.mrkl.Builder
io.crums.util.mrkl.FixedLeafBuilder
- Direct Known Subclasses:
DeltaBuilder
public class FixedLeafBuilder extends Builder
-
Field Summary
Fields inherited from class io.crums.util.mrkl.Builder
copyOnWrite, data, digest, lock
-
Constructor Summary
Constructors Modifier Constructor Description protected
FixedLeafBuilder(FixedLeafBuilder copy)
FixedLeafBuilder(java.lang.String algo)
FixedLeafBuilder(java.lang.String algo, boolean copyOnWrite)
FixedLeafBuilder(java.lang.String algo, int leafWidth)
FixedLeafBuilder(java.lang.String algo, int leafWidth, boolean copyOnWrite)
-
Method Summary
Methods inherited from class io.crums.util.mrkl.Builder
add, clear, completeTree, count, getHashAlgo, hash, hashWidth, item, level, levelSize, newByteArrayList
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
FixedLeafBuilder
public FixedLeafBuilder(java.lang.String algo)- Parameters:
algo
-- Throws:
java.lang.IllegalArgumentException
-
FixedLeafBuilder
public FixedLeafBuilder(java.lang.String algo, int leafWidth) throws java.lang.IllegalArgumentException- Parameters:
algo
-- Throws:
java.lang.IllegalArgumentException
-
FixedLeafBuilder
public FixedLeafBuilder(java.lang.String algo, int leafWidth, boolean copyOnWrite) throws java.lang.IllegalArgumentException- Parameters:
algo
-copyOnWrite
-- Throws:
java.lang.IllegalArgumentException
-
FixedLeafBuilder
public FixedLeafBuilder(java.lang.String algo, boolean copyOnWrite) throws java.lang.IllegalArgumentException- Parameters:
algo
-copyOnWrite
-- Throws:
java.lang.IllegalArgumentException
-
FixedLeafBuilder
-
-
Method Details
-
leafWidth
public int leafWidth() -
add
public int add(byte[] item, int off, int len) throws java.lang.IllegalArgumentException, java.lang.IndexOutOfBoundsExceptionDescription copied from class:Builder
Adds the specified item as the next leaf node are returns its leaf index.- Overrides:
add
in classBuilder
- Parameters:
len
- = leafWidth()item
- the item's data (copied)off
- starting offset into item- Returns:
- the item's leaf node index in the to-be built tree
- Throws:
java.lang.IllegalArgumentException
- if len ≠ leafWidth()java.lang.IndexOutOfBoundsException
-
build
Description copied from class:Builder
Builds and returns the tree. On return the builder is cleared.- Overrides:
build
in classBuilder
- See Also:
Builder.clear()
-
packageTree
- Overrides:
packageTree
in classBuilder
-