Skip to content

Commit 91c4c57

Browse files
thscthsc
authored andcommitted
working.. no working version yet
1 parent 5335d2e commit 91c4c57

File tree

10 files changed

+250
-142
lines changed

10 files changed

+250
-142
lines changed

nbproject/project.properties

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
1-
#Mon Jan 07 17:57:59 CET 2019
1+
application.title=ASP3Java
2+
application.vendor=thsc
3+
endorsed.classpath=
4+
#Tue Jan 08 10:18:01 CET 2019
25
excludes=
36
javac.deprecation=false
4-
jlink.additionalparam=
57
build.test.results.dir=${build.dir}/test/results
6-
run.classpath=${javac.classpath}\:${build.classes.dir}
8+
jlink.additionalparam=
9+
javac.external.vm=true
710
jlink.additionalmodules=
11+
run.classpath=\
12+
${javac.classpath}:\
13+
${build.classes.dir}
814
javadoc.nonavbar=false
9-
javac.external.vm=true
10-
javac.test.modulepath=${javac.modulepath}
11-
run.test.classpath=${javac.test.classpath}\:${build.test.classes.dir}
15+
javac.test.modulepath=\
16+
${javac.modulepath}
17+
run.test.classpath=\
18+
${javac.test.classpath}:\
19+
${build.test.classes.dir}
1220
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
13-
javac.processorpath=${javac.classpath}
21+
javac.processorpath=\
22+
${javac.classpath}
1423
javac.target=1.8
1524
annotation.processing.processors.list=
1625
javadoc.noindex=false
@@ -25,53 +34,53 @@ javadoc.author=false
2534
test.src.dir=${file.reference.ASP3Java-test}
2635
build.dir=build
2736
build.test.classes.dir=${build.dir}/test/classes
28-
run.modulepath=${javac.modulepath}
2937
platform.active=default_platform
3038
javac.compilerargs=
39+
run.modulepath=\
40+
${javac.modulepath}
3141
main.class=
3242
dist.jar=${dist.dir}/ASP3Java.jar
3343
javac.test.processorpath=${javac.test.classpath}
34-
javadoc.use=true
3544
file.reference.ASP3Java-src=src
36-
dist.archive.excludes=
45+
javadoc.use=true
3746
build.sysclasspath=ignore
47+
dist.archive.excludes=
3848
debug.test.classpath=${run.test.classpath}
3949
dist.dir=dist
4050
build.classes.excludes=**/*.java,**/*.form
41-
annotation.processing.processor.options=
42-
javadoc.splitindex=true
4351
javadoc.encoding=${source.encoding}
52+
javadoc.splitindex=true
4453
javac.source=1.8
4554
javac.modulepath=
46-
junit.selected.version=4
55+
junit.selected.version=3
4756
debug.classpath=${run.classpath}
4857
run.jvmargs=
49-
run.test.modulepath=${javac.test.modulepath}
58+
run.test.modulepath=\
59+
${javac.test.modulepath}
60+
jar.compress=false
61+
build.generated.dir=${build.dir}/generated
5062
javac.test.classpath=\
5163
${javac.classpath}:\
5264
${build.classes.dir}:\
53-
${libs.junit.classpath}:\
5465
${libs.junit_4.classpath}:\
5566
${libs.hamcrest.classpath}
56-
build.generated.dir=${build.dir}/generated
57-
jar.compress=false
5867
javadoc.private=false
5968
debug.test.modulepath=${run.test.modulepath}
6069
annotation.processing.run.all.processors=true
6170
meta.inf.dir=${src.dir}/META-INF
62-
manifest.file=manifest.mf
6371
annotation.processing.enabled=true
72+
manifest.file=manifest.mf
6473
jlink.launcher=true
65-
dist.jlink.output=${dist.jlink.dir}/ASP3Java
6674
dist.javadoc.dir=${dist.dir}/javadoc
67-
src.dir=${file.reference.ASP3Java-src}
75+
dist.jlink.output=${dist.jlink.dir}/ASP3Java
6876
debug.modulepath=${run.modulepath}
77+
src.dir=${file.reference.ASP3Java-src}
6978
mkdist.disabled=false
70-
javac.classpath=
7179
annotation.processing.enabled.in.editor=false
80+
javac.classpath=
7281
dist.jlink.dir=${dist.dir}/jlink
73-
jlink.launcher.name=ASP3Java
7482
build.generated.sources.dir=${build.dir}/generated-sources
83+
jlink.launcher.name=ASP3Java
7584
javadoc.version=false
7685
javadoc.windowtitle=
7786
javadoc.notree=false

src/net/sharksystem/asp3/ASP3Chunk.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
* @author thsc
1212
*/
13-
interface ASP3Chunk {
13+
public interface ASP3Chunk {
1414

1515
/**
1616
*
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
package net.sharksystem.asp3;
2+
3+
import java.io.DataInputStream;
4+
import java.io.IOException;
5+
6+
class ASP3ChunkReader implements Runnable {
7+
ASP3Reader reader;
8+
private final DataInputStream dis;
9+
private final String peer;
10+
private final String owner;
11+
12+
ASP3ChunkReader(ASP3Reader reader, DataInputStream dis, String owner,
13+
String peer) {
14+
this.reader = reader;
15+
this.dis = dis;
16+
this.peer = peer;
17+
this.owner = owner;
18+
}
19+
20+
private String getLogStart() {
21+
StringBuilder b = new StringBuilder();
22+
b.append("ASP3ChunkReader (");
23+
b.append(this.owner);
24+
b.append(") connected to (");
25+
b.append(this.peer);
26+
b.append(") ");
27+
28+
return b.toString();
29+
}
30+
31+
@Override
32+
public void run() {
33+
//<<<<<<<<<<<<<<<<<<debug
34+
StringBuilder b = new StringBuilder();
35+
b.append(this.getLogStart());
36+
b.append("start reading ");
37+
System.out.println(b.toString());
38+
//>>>>>>>>>>>>>>>>>>>debug
39+
40+
try {
41+
String chunkUrl = dis.readUTF();
42+
//<<<<<<<<<<<<<<<<<<debug
43+
b = new StringBuilder();
44+
b.append(this.getLogStart());
45+
b.append("read chunk URL: ");
46+
b.append(chunkUrl);
47+
System.out.println(b.toString());
48+
//>>>>>>>>>>>>>>>>>>>debug
49+
for(;;) {
50+
// escapes with IOException
51+
String message = dis.readUTF();
52+
//<<<<<<<<<<<<<<<<<<debug
53+
b = new StringBuilder();
54+
b.append(this.getLogStart());
55+
b.append("read message: ");
56+
b.append(message);
57+
System.out.println(b.toString());
58+
//>>>>>>>>>>>>>>>>>>>debug
59+
60+
if(this.reader != null) {
61+
this.reader.read(chunkUrl, peer, message);
62+
}
63+
}
64+
} catch (IOException ex) {
65+
// done
66+
}
67+
}
68+
}

src/net/sharksystem/asp3/ASP3Writer.java renamed to src/net/sharksystem/asp3/ASP3ChunkStorage.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* @author thsc
99
*/
10-
public interface ASP3Writer {
10+
public interface ASP3ChunkStorage extends ASP3Storage {
1111

1212
public void addRecipient(CharSequence urlTarget, CharSequence recipient) throws IOException;
1313
public void setRecipients(CharSequence urlTarget, List<CharSequence> recipients) throws IOException;
@@ -20,4 +20,5 @@ public interface ASP3Writer {
2020
public int getOldestEra();
2121
public int getEra();
2222
public int getNextEra(int era);
23+
public int getPreviousEra(int era);
2324
}

0 commit comments

Comments
 (0)