Skip to content

Commit ab0e398

Browse files
committed
Add new constructor
1 parent 2865360 commit ab0e398

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>io.ipfs</groupId>
66
<artifactId>multihash</artifactId>
7-
<version>1.0.0</version>
7+
<version>1.1.0</version>
88
<packaging>jar</packaging>
99

1010
<name>multihash</name>

src/main/java/io/ipfs/multihash/Multihash.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ public Multihash(Type type, byte[] hash) {
4646
this.hash = hash;
4747
}
4848

49+
public Multihash(Multihash toClone) {
50+
this(toClone.type, toClone.hash); // N.B. despite being a byte[], hash is immutable
51+
}
52+
4953
public Multihash(byte[] multihash) {
5054
this(Type.lookup(multihash[0] & 0xff), Arrays.copyOfRange(multihash, 2, multihash.length));
5155
}

0 commit comments

Comments
 (0)