We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3749171 commit 7d6cd63Copy full SHA for 7d6cd63
src/main/java/org/ipfs/api/Multihash.java
@@ -56,6 +56,19 @@ public byte[] toBytes() {
56
return res;
57
}
58
59
+ public void serialize(DataOutput dout) throws IOException {
60
+ dout.write(toBytes());
61
+ }
62
+
63
+ public static Multihash deserialize(DataInput din) throws IOException {
64
+ int type = din.readUnsignedByte();
65
+ int len = din.readUnsignedByte();
66
+ Type t = Type.lookup(type);
67
+ byte[] hash = new byte[len];
68
+ din.readFully(hash);
69
+ return new Multihash(t, hash);
70
71
72
@Override
73
public String toString() {
74
return toBase58();
0 commit comments