Skip to content

Commit a27ef5b

Browse files
committed
Fixed access for IPFS inner classes
1 parent 76d9c28 commit a27ef5b

File tree

4 files changed

+19
-17
lines changed

4 files changed

+19
-17
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ tests:
2222
jar -cfm Tests.jar def.manifest \
2323
-C build org
2424
rm -f def.manifest
25-
java -cp $(CP):Tests.jar org.junit.runner.JUnitCore org.ipfs.Test
25+
java -cp $(CP):Tests.jar org.junit.runner.JUnitCore org.ipfs.test.Test

src/org/ipfs/IPFS.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,15 @@ public Map mount(java.io.File ipfsRoot, java.io.File ipnsRoot) throws IOExceptio
9494
}
9595

9696
// level 2 commands
97-
class Refs {
97+
public class Refs {
9898
public List<Multihash> local() throws IOException {
9999
return Arrays.asList(new String(retrieve("refs/local")).split("\n")).stream().map(Multihash::fromBase58).collect(Collectors.toList());
100100
}
101101
}
102102

103103
/* Pinning an object ensures a local copy of it is kept.
104104
*/
105-
class Pin {
105+
public class Pin {
106106
public List<Multihash> add(Multihash hash) throws IOException {
107107
return ((List<Object>)((Map)retrieveAndParse("pin/add?stream-channels=true&arg=" + hash)).get("Pinned"))
108108
.stream()
@@ -132,15 +132,15 @@ public List<Multihash> rm(Multihash hash, boolean recursive) throws IOException
132132

133133
/* 'ipfs repo' is a plumbing command used to manipulate the repo.
134134
*/
135-
class Repo {
135+
public class Repo {
136136
public Object gc() throws IOException {
137137
return retrieveAndParse("repo/gc");
138138
}
139139
}
140140

141141
/* 'ipfs block' is a plumbing command used to manipulate raw ipfs blocks.
142142
*/
143-
class Block {
143+
public class Block {
144144
public byte[] get(Multihash hash) throws IOException {
145145
return retrieve("block/get?stream-channels=true&arg=" + hash);
146146
}
@@ -160,7 +160,7 @@ public Map stat(Multihash hash) throws IOException {
160160

161161
/* 'ipfs object' is a plumbing command used to manipulate DAG objects directly. {Object} is a subset of {Block}
162162
*/
163-
class IPFSObject {
163+
public class IPFSObject {
164164
public List<MerkleNode> put(List<byte[]> data) throws IOException {
165165
Multipart m = new Multipart("http://" + host + ":" + port + version+"object/put?stream-channels=true", "UTF-8");
166166
for (byte[] f : data)
@@ -198,7 +198,7 @@ public MerkleNode _new(Optional<String> template) throws IOException {
198198
// TODO patch
199199
}
200200

201-
class Name {
201+
public class Name {
202202
public Map publish(Multihash hash) throws IOException {
203203
return publish(Optional.empty(), hash);
204204
}
@@ -213,7 +213,7 @@ public String resolve(Multihash hash) throws IOException {
213213
}
214214
}
215215

216-
class DHT {
216+
public class DHT {
217217
public Map findprovs(Multihash hash) throws IOException {
218218
return retrieveMap("dht/findprovs?arg=" + hash);
219219
}
@@ -235,7 +235,7 @@ public Map put(String key, String value) throws IOException {
235235
}
236236
}
237237

238-
class File {
238+
public class File {
239239
public Map ls(Multihash path) throws IOException {
240240
return retrieveMap("file/ls?arg=" + path);
241241
}
@@ -247,7 +247,7 @@ public List<MultiAddress> bootstrap() throws IOException {
247247
return ((List<String>)retrieveMap("bootstrap/").get("Peers")).stream().map(x -> new MultiAddress(x)).collect(Collectors.toList());
248248
}
249249

250-
class Bootstrap {
250+
public class Bootstrap {
251251
public List<MultiAddress> list() throws IOException {
252252
return bootstrap();
253253
}
@@ -269,7 +269,7 @@ public List<MultiAddress> rm(MultiAddress addr, boolean all) throws IOException
269269
component that opens, listens for, and maintains connections to other
270270
ipfs peers in the internet.
271271
*/
272-
class Swarm {
272+
public class Swarm {
273273
public List<MultiAddress> peers() throws IOException {
274274
Map m = retrieveMap("swarm/peers?stream-channels=true");
275275
return ((List<Object>)m.get("Strings")).stream().map(x -> new MultiAddress((String)x)).collect(Collectors.toList());
@@ -291,7 +291,7 @@ public Map disconnect(String multiAddr) throws IOException {
291291
}
292292
}
293293

294-
class Diag {
294+
public class Diag {
295295
public String net() throws IOException {
296296
return new String(retrieve("diag/net?stream-channels=true"));
297297
}
@@ -305,7 +305,7 @@ public Map id(String target) throws IOException {
305305
return retrieveMap("id/" + target.toString());
306306
}
307307

308-
class Stats {
308+
public class Stats {
309309
public Map bw() throws IOException {
310310
return retrieveMap("stats/bw");
311311
}
@@ -325,7 +325,7 @@ public Map log() throws IOException {
325325
return retrieveMap("log/tail");
326326
}
327327

328-
class Config {
328+
public class Config {
329329
public Map show() throws IOException {
330330
return (Map)retrieveAndParse("config/show");
331331
}
@@ -350,7 +350,7 @@ public Object update() throws IOException {
350350
return retrieveAndParse("update");
351351
}
352352

353-
class Update {
353+
public class Update {
354354
public Object check() throws IOException {
355355
return retrieveAndParse("update/check");
356356
}

src/org/ipfs/Multihash.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import java.util.*;
55

66
public class Multihash {
7-
enum Type {
7+
public enum Type {
88
sha1(0x11, 20),
99
sha2_256(0x12, 32),
1010
sha2_512(0x13, 64),

test/org/ipfs/Test.java renamed to test/org/ipfs/test/Test.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
package org.ipfs;
1+
package org.ipfs.test;
2+
3+
import org.ipfs.*;
24

35
import java.io.*;
46
import java.util.*;

0 commit comments

Comments
 (0)