Mercurial > jhg
comparison src/com/tmate/hgkit/ll/Nodeid.java @ 41:858d1b2458cb
Check integrity for bundle changelog. Sort nodeids when calculating hash
| author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
|---|---|
| date | Fri, 14 Jan 2011 04:14:08 +0100 |
| parents | 51bc56c0addd |
| children | 4022c34a4804 |
comparison
equal
deleted
inserted
replaced
| 40:21e26da142fa | 41:858d1b2458cb |
|---|---|
| 73 } | 73 } |
| 74 } | 74 } |
| 75 return true; | 75 return true; |
| 76 } | 76 } |
| 77 | 77 |
| 78 // primary purpose is to give DigestHelper access to internal structure. Despite it's friends-only (package visibility), it's still makes sense to | |
| 79 // return a copy, to avoid any accidental modification (same reason field is not made visible, nor any callback, e.g. Output.write(byte[]) was introduced) | |
| 80 /*package-local*/byte[] cloneData() { | |
| 81 return binaryData.clone(); | |
| 82 } | |
| 83 | |
| 78 // primary difference with cons is handling of NULL id (this method returns constant) | 84 // primary difference with cons is handling of NULL id (this method returns constant) |
| 79 // always makes a copy of an array passed | 85 // always makes a copy of an array passed |
| 80 public static Nodeid fromBinary(byte[] binaryRepresentation, int offset) { | 86 public static Nodeid fromBinary(byte[] binaryRepresentation, int offset) { |
| 81 if (binaryRepresentation == null || binaryRepresentation.length - offset < 20) { | 87 if (binaryRepresentation == null || binaryRepresentation.length - offset < 20) { |
| 82 throw new IllegalArgumentException(); | 88 throw new IllegalArgumentException(); |
