@@ -40,7 +40,7 @@ public enum PinType {all, direct, indirect, recursive}
4040 public final Stats stats = new Stats ();
4141 public final Name name = new Name ();
4242 public final Pubsub pubsub = new Pubsub ();
43-
43+
4444 public IPFS (String host , int port ) {
4545 this (host , port , "/api/v0/" , false );
4646 }
@@ -56,13 +56,13 @@ public IPFS(MultiAddress addr) {
5656 public IPFS (String host , int port , String version , boolean ssl ) {
5757 this .host = host ;
5858 this .port = port ;
59-
59+
6060 if (ssl ) {
6161 this .protocol = "https" ;
6262 } else {
6363 this .protocol = "http" ;
6464 }
65-
65+
6666 this .version = version ;
6767 // Check IPFS is sufficiently recent
6868 try {
@@ -73,7 +73,7 @@ public IPFS(String host, int port, String version, boolean ssl) {
7373 throw new RuntimeException (e );
7474 }
7575 }
76-
76+
7777 public List <MerkleNode > add (NamedStreamable file ) throws IOException {
7878 return add (file , false );
7979 }
@@ -493,7 +493,7 @@ public Map disconnect(String multiAddr) throws IOException {
493493
494494 public class Dag {
495495 public byte [] get (Cid cid ) throws IOException {
496- return retrieve ("block /get?stream-channels=true&arg=" + cid );
496+ return retrieve ("dag /get?stream-channels=true&arg=" + cid );
497497 }
498498
499499 public MerkleNode put (byte [] object ) throws IOException {
@@ -509,9 +509,8 @@ public MerkleNode put(byte[] object, String outputFormat) throws IOException {
509509 }
510510
511511 public MerkleNode put (String inputFormat , byte [] object , String outputFormat ) throws IOException {
512- block .put (Arrays .asList (object ));
513- String prefix = protocol +"://" + host + ":" + port + version ;
514- Multipart m = new Multipart (prefix + "block/put/?stream-channels=true&input-enc=" + inputFormat + "&f=" + outputFormat , "UTF-8" );
512+ String prefix = protocol + "://" + host + ":" + port + version ;
513+ Multipart m = new Multipart (prefix + "dag/put/?stream-channels=true&input-enc=" + inputFormat + "&f=" + outputFormat , "UTF-8" );
515514 m .addFilePart ("file" , Paths .get ("" ), new NamedStreamable .ByteArrayWrapper (object ));
516515 String res = m .finish ();
517516 return MerkleNode .fromJSON (JSONParser .parse (res ));
@@ -724,7 +723,7 @@ private static final byte[] readFully(InputStream in) throws IOException {
724723 resp .write (buf , 0 , r );
725724 return resp .toByteArray ();
726725 }
727-
726+
728727 private static boolean detectSSL (MultiAddress multiaddress ) {
729728 return multiaddress .toString ().contains ("/https" );
730729 }
0 commit comments