Changeset 9ee8e04


Ignore:
Timestamp:
Jan 21, 2011 3:52:12 PM (10 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
e924052
Parents:
b80c0546
Message:

small optimization in TunnelID

File:
1 edited

Legend:

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

    rb80c0546 r9ee8e04  
    5151    }
    5252
     53    /**
     54     * Overridden for efficiency.
     55     */
     56    @Override
     57    public byte[] toByteArray() {
     58        return DataHelper.toLong(4, _tunnelId);
     59    }
     60
     61    /**
     62     * Overridden for efficiency.
     63     * @param data non-null
     64     * @throws DataFormatException if null or wrong length
     65     */
     66    @Override
     67    public void fromByteArray(byte data[]) throws DataFormatException {
     68        if (data == null) throw new DataFormatException("Null data passed in");
     69        if (data.length != 4) throw new DataFormatException("Bad data length");
     70        _tunnelId = (int) DataHelper.fromLong(data, 0, 4);
     71    }
     72
    5373    @Override
    5474    public boolean equals(Object obj) {
Note: See TracChangeset for help on using the changeset viewer.