Skip to content

Commit 7f4e2b3

Browse files
committed
minor fixes
1 parent 0e49f11 commit 7f4e2b3

File tree

4 files changed

+19
-15
lines changed

4 files changed

+19
-15
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ Feel free to join in. All welcome. Open an [issue](https://github.com/ipfs/java-
114114

115115
This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).
116116

117-
[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md)
117+
[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)
118118

119119
## License
120120

src/main/java/io/ipfs/api/IPFS.java

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public Map resolve(String scheme, Multihash hash, boolean recursive) throws IOEx
160160
return retrieveMap("resolve?arg=/" + scheme+"/"+hash +"&r="+recursive);
161161
}
162162

163-
163+
@Deprecated
164164
public String dns(String domain, boolean recursive) throws IOException {
165165
Map res = retrieveMap("dns?arg=" + domain + "&r=" + recursive);
166166
return (String)res.get("Path");
@@ -353,14 +353,15 @@ public Map stat(Multihash hash) throws IOException {
353353
/* 'ipfs object' is a plumbing command used to manipulate DAG objects directly. {Object} is a subset of {Block}
354354
*/
355355
public class IPFSObject {
356+
@Deprecated
356357
public List<MerkleNode> put(List<byte[]> data) throws IOException {
357358
Multipart m = new Multipart(protocol +"://" + host + ":" + port + version+"object/put?stream-channels=true", "UTF-8");
358359
for (byte[] f : data)
359360
m.addFilePart("file", Paths.get(""), new NamedStreamable.ByteArrayWrapper(f));
360361
String res = m.finish();
361362
return JSONParser.parseStream(res).stream().map(x -> MerkleNode.fromJSON((Map<String, Object>) x)).collect(Collectors.toList());
362363
}
363-
364+
@Deprecated
364365
public List<MerkleNode> put(String encoding, List<byte[]> data) throws IOException {
365366
if (!"json".equals(encoding) && !"protobuf".equals(encoding))
366367
throw new IllegalArgumentException("Encoding must be json or protobuf");
@@ -370,33 +371,33 @@ public List<MerkleNode> put(String encoding, List<byte[]> data) throws IOExcepti
370371
String res = m.finish();
371372
return JSONParser.parseStream(res).stream().map(x -> MerkleNode.fromJSON((Map<String, Object>) x)).collect(Collectors.toList());
372373
}
373-
374+
@Deprecated
374375
public MerkleNode get(Multihash hash) throws IOException {
375376
Map json = retrieveMap("object/get?stream-channels=true&arg=" + hash);
376377
json.put("Hash", hash.toBase58());
377378
return MerkleNode.fromJSON(json);
378379
}
379-
380+
@Deprecated
380381
public MerkleNode links(Multihash hash) throws IOException {
381382
Map json = retrieveMap("object/links?stream-channels=true&arg=" + hash);
382383
return MerkleNode.fromJSON(json);
383384
}
384-
385+
@Deprecated
385386
public Map<String, Object> stat(Multihash hash) throws IOException {
386387
return retrieveMap("object/stat?stream-channels=true&arg=" + hash);
387388
}
388-
389+
@Deprecated
389390
public byte[] data(Multihash hash) throws IOException {
390391
return retrieve("object/data?stream-channels=true&arg=" + hash);
391392
}
392-
393+
@Deprecated
393394
public MerkleNode _new(Optional<String> template) throws IOException {
394395
if (template.isPresent() && !ObjectTemplates.contains(template.get()))
395396
throw new IllegalStateException("Unrecognised template: "+template.get());
396397
Map json = retrieveMap("object/new?stream-channels=true"+(template.isPresent() ? "&arg=" + template.get() : ""));
397398
return MerkleNode.fromJSON(json);
398399
}
399-
400+
@Deprecated
400401
public MerkleNode patch(Multihash base, String command, Optional<byte[]> data, Optional<String> name, Optional<Multihash> target) throws IOException {
401402
if (!ObjectPatchTypes.contains(command))
402403
throw new IllegalStateException("Illegal Object.patch command type: "+command);
@@ -445,6 +446,7 @@ public String resolve(Multihash hash) throws IOException {
445446
}
446447

447448
public class DHT {
449+
@Deprecated
448450
public List<Map<String, Object>> findprovs(Multihash hash) throws IOException {
449451
return getAndParseStream("dht/findprovs?arg=" + hash).stream()
450452
.map(x -> (Map<String, Object>) x)
@@ -454,21 +456,22 @@ public List<Map<String, Object>> findprovs(Multihash hash) throws IOException {
454456
public Map query(Multihash peerId) throws IOException {
455457
return retrieveMap("dht/query?arg=" + peerId.toString());
456458
}
457-
459+
@Deprecated
458460
public Map findpeer(Multihash id) throws IOException {
459461
return retrieveMap("dht/findpeer?arg=" + id.toString());
460462
}
461-
463+
@Deprecated
462464
public Map get(Multihash hash) throws IOException {
463465
return retrieveMap("dht/get?arg=" + hash);
464466
}
465-
467+
@Deprecated
466468
public Map put(String key, String value) throws IOException {
467469
return retrieveMap("dht/put?arg=" + key + "&arg="+value);
468470
}
469471
}
470472

471473
public class File {
474+
@Deprecated
472475
public Map ls(Multihash path) throws IOException {
473476
return retrieveMap("file/ls?arg=" + path);
474477
}

src/main/java/io/ipfs/api/Multipart.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public Multipart(String requestURL, String charset) {
2525
httpConn.setDoInput(true);
2626
httpConn.setRequestProperty("Expect", "100-continue");
2727
httpConn.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary);
28-
httpConn.setRequestProperty("User-Agent", "Java IPFS CLient");
28+
httpConn.setRequestProperty("User-Agent", "Java IPFS Client");
2929
httpConn.setChunkedStreamingMode(4096);
3030
out = httpConn.getOutputStream();
3131
} catch (IOException e) {

src/test/java/io/ipfs/api/APITest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ public void pubsubSynchronous() {
415415

416416
int nMessages = 100;
417417
for (int i = 1; i < nMessages; ) {
418-
ipfs.pubsub.pub(topic, "Hello!");
418+
ipfs.pubsub.pub(topic, "Hello World!");
419419
if (res.size() >= i) {
420420
i++;
421421
}
@@ -427,7 +427,7 @@ public void pubsubSynchronous() {
427427
public void pubsub() throws Exception {
428428
String topic = "topic" + System.nanoTime();
429429
Stream<Map<String, Object>> sub = ipfs.pubsub.sub(topic);
430-
String data = "Hello!";
430+
String data = "Hello World!";
431431
ipfs.pubsub.pub(topic, data);
432432
ipfs.pubsub.pub(topic, "G'day");
433433
List<Map> results = sub.limit(2).collect(Collectors.toList());
@@ -623,6 +623,7 @@ public void mountTest() throws IOException {
623623
}
624624

625625
@Test
626+
@Ignore("dhtTest may fail with timeout")
626627
public void dhtTest() throws IOException {
627628
MerkleNode raw = ipfs.block.put("Mathematics is wonderful".getBytes(), Optional.of("raw"));
628629
// Map get = ipfs.dht.get(raw.hash);

0 commit comments

Comments
 (0)