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 Details

    • serialVersionUID

      private static final long serialVersionUID
      Pinned 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:
      compare in interface Comparator<byte[]>
      Parameters:
      l - the first key
      r - the second key
      Returns:
      negative if l is less, positive if greater, 0 if equal