java.lang.Object
org.klomp.snark.bencode.BEncoder.ByteKeyComparator
- All Implemented Interfaces:
Serializable, Comparator<byte[]>
- Enclosing class:
BEncoder
private static class BEncoder.ByteKeyComparatorextends Object implements Comparator<byte[]>, Serializable
Comparator for bencode map keys given as byte arrays.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final longPinned for serialized-form compatibility.Constructor Summary
ConstructorsMethod Summary
All MethodsModifier and TypeMethodDescriptionintcompare(byte[] l, byte[] r) Compares two byte array keys lexicographically, treating bytes as unsigned.Methods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Comparator
equals, max, min, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
Field Details
serialVersionUID
private static final long serialVersionUIDPinned for serialized-form compatibility.- See Also:
Constructor Details
ByteKeyComparator
private ByteKeyComparator()Orders bencode keys given as bytes.
Method Details
compare
public int compare(byte[] l, byte[] r) Compares two byte array keys lexicographically, treating bytes as unsigned.- Specified by:
comparein interfaceComparator<byte[]>- Parameters:
l- the first keyr- the second key- Returns:
- negative if l is less, positive if greater, 0 if equal