Package org.klomp.snark.v2
Class PieceLayers
- All Implemented Interfaces:
Serializable,Cloneable,Map<MerkleHash,,List<MerkleHash>> NavigableMap<MerkleHash,,List<MerkleHash>> SequencedMap<MerkleHash,,List<MerkleHash>> SortedMap<MerkleHash,List<MerkleHash>>
A map for the 'piece layers' dictionary,
since a standard map with a byte[] for keys is awkward in Java,
as is converting the byte arrays to strings.
- Since:
- 0.9.71
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> -
Constructor Summary
ConstructorsConstructorDescriptionFrom BDecoderPieceLayers(int piece_length, List<List<MerkleHash>> hashes, List<Long> lengths, List<String> atts) From torrent creator Hashes are one list per file More efficient -
Method Summary
Modifier and TypeMethodDescriptionbdecode(InputStream in) voidbencode(OutputStream out) toString()voidvalidate(int piece_length) check that the merkles in the layers are correctMethods inherited from class java.util.TreeMap
ceilingEntry, ceilingKey, clear, clone, comparator, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, descendingKeySet, descendingMap, entrySet, firstEntry, firstKey, floorEntry, floorKey, forEach, get, headMap, headMap, higherEntry, higherKey, keySet, lastEntry, lastKey, lowerEntry, lowerKey, merge, navigableKeySet, pollFirstEntry, pollLastEntry, put, putAll, putFirst, putIfAbsent, putLast, remove, replace, replace, replaceAll, size, subMap, subMap, tailMap, tailMap, valuesMethods inherited from class java.util.AbstractMap
equals, hashCode, isEmptyMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.NavigableMap
reversedMethods inherited from interface java.util.SequencedMap
sequencedEntrySet, sequencedKeySet, sequencedValues
-
Constructor Details
-
PieceLayers
public PieceLayers()From BDecoder -
PieceLayers
public PieceLayers(int piece_length, List<List<MerkleHash>> hashes, List<Long> lengths, List<String> atts) throws InvalidBEncodingException From torrent creator Hashes are one list per file More efficient- Parameters:
hashes- one per file, not including padding fileslengths- one per fileatts- one per file or null, indicates padding files- Throws:
InvalidBEncodingException
-
-
Method Details
-
bdecode
- Throws:
IOException
-
bencode
- Throws:
IOException
-
validate
check that the merkles in the layers are correct- Throws:
InvalidBEncodingException
-
toString
- Overrides:
toStringin classAbstractMap<MerkleHash,List<MerkleHash>>
-