Changeset a2c867c


Ignore:
Timestamp:
Sep 24, 2011 9:45:52 PM (8 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
4822e47
Parents:
fd1c8c4
Message:

cleanups

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • core/java/src/net/i2p/data/DataHelper.java

    rfd1c8c4 ra2c867c  
    5656 */
    5757public class DataHelper {
    58     private static final byte EQUAL_BYTES[];
    59     private static final byte SEMICOLON_BYTES[];
    60     static {
    61         try {
    62             EQUAL_BYTES = "=".getBytes("UTF-8");
    63             SEMICOLON_BYTES = ";".getBytes("UTF-8");
    64         } catch (UnsupportedEncodingException uee) {
    65             throw new RuntimeException("no utf8!?");
    66         }
    67     }
     58    private static final byte[] EQUAL_BYTES = getUTF8("=");
     59    private static final byte[] SEMICOLON_BYTES = getUTF8(";");
    6860
    6961    /** Read a mapping from the stream, as defined by the I2P data structure spec,
  • router/java/src/net/i2p/router/networkdb/kademlia/XORComparator.java

    rfd1c8c4 ra2c867c  
    1111 */
    1212class XORComparator implements Comparator<Hash> {
    13     private final Hash _base;
     13    private final byte[] _base;
    1414
    1515    /**
     
    1717     */
    1818    public XORComparator(Hash target) {
    19         _base = target;
     19        _base = target.getData();
    2020    }
    2121
    2222    public int compare(Hash lhs, Hash rhs) {
    23         if (lhs == null) throw new NullPointerException("LHS is null");
    24         if (rhs == null) throw new NullPointerException("RHS is null");
    25         byte lhsDelta[] = DataHelper.xor(lhs.getData(), _base.getData());
    26         byte rhsDelta[] = DataHelper.xor(rhs.getData(), _base.getData());
     23        byte lhsDelta[] = DataHelper.xor(lhs.getData(), _base);
     24        byte rhsDelta[] = DataHelper.xor(rhs.getData(), _base);
    2725        return DataHelper.compareTo(lhsDelta, rhsDelta);
    2826    }
Note: See TracChangeset for help on using the changeset viewer.