Skip to content

Commit

Permalink
Add new constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
ianopolous committed Jan 24, 2017
1 parent 2865360 commit ab0e398
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>io.ipfs</groupId>
<artifactId>multihash</artifactId>
<version>1.0.0</version>
<version>1.1.0</version>
<packaging>jar</packaging>

<name>multihash</name>
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/io/ipfs/multihash/Multihash.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ public Multihash(Type type, byte[] hash) {
this.hash = hash;
}

public Multihash(Multihash toClone) {
this(toClone.type, toClone.hash); // N.B. despite being a byte[], hash is immutable
}

public Multihash(byte[] multihash) {
this(Type.lookup(multihash[0] & 0xff), Arrays.copyOfRange(multihash, 2, multihash.length));
}
Expand Down

0 comments on commit ab0e398

Please sign in to comment.