java.lang.Object
org.klomp.snark.bencode.BEncoder.StringKeyComparator
- All Implemented Interfaces:
Serializable, Comparator<String>
- Enclosing class:
BEncoder
private static class BEncoder.StringKeyComparatorextends Object implements Comparator<String>, Serializable
Compares bencode map keys given as Strings, in the order the spec requires: as their UTF-8 encodings, byte by byte, with a shorter key that is a prefix of a longer one ordered first.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final longPinned for serialized-form compatibility.Constructor Summary
ConstructorsModifierConstructorDescriptionprivateOrders bencode keys so the output is stable.Method Summary
All MethodsMethods 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
StringKeyComparator
private StringKeyComparator()Orders bencode keys so the output is stable.
Method Details
compare
Compares two keys by their UTF-8 encodings.- Specified by:
comparein interfaceComparator<String>- Parameters:
l- the first keyr- the second key- Returns:
- negative if l is less, positive if greater, 0 if equal