Skip to content

Commit 1156c89

Browse files
Java module support is included
1 parent d56a50f commit 1156c89

20 files changed

+66
-26
lines changed

.classpath

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
</attributes>
77
</classpathentry>
88
<classpathentry kind="src" path="src"/>
9-
<classpathentry kind="lib" path="C:/softnet.java.eclipse/softnet/asncodec.jar"/>
9+
<classpathentry kind="lib" path="C:/softnet.java.eclipse.with-module-info/softnet/asncodec.jar">
10+
<attributes>
11+
<attribute name="module" value="true"/>
12+
</attributes>
13+
</classpathentry>
1014
<classpathentry kind="output" path="bin"/>
1115
</classpath>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
eclipse.preferences.version=1
2+
encoding/<project>=UTF-8

.settings/org.eclipse.jdt.core.prefs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ org.eclipse.jdt.core.compiler.debug.localVariable=generate
88
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
99
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
1010
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11+
org.eclipse.jdt.core.compiler.release=enabled
1112
org.eclipse.jdt.core.compiler.source=1.7

src/module-info.java

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright 2023 Robert Koifman
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
/**
17+
* @author Robert Koifman
18+
**/
19+
/**
20+
* The Softnet Endpoint Library (Java) utilizes data types and packages from Java SE 1.7.
21+
* If your application is assumed to use the Java 1.7 or Java 1.8 runtime,
22+
* you can also target this library to that runtime. In this case, to compile this library
23+
* you need to comment out the following code. Otherwise, starting with Java 1.9,
24+
* Java applications use Java Platform Module System (JMPS), and this code is required
25+
* to declare module-related information and dependencies.
26+
**/
27+
/*
28+
module softnet {
29+
requires transitive asncodec;
30+
exports softnet;
31+
exports softnet.client;
32+
exports softnet.service;
33+
exports softnet.exceptions;
34+
}
35+
*/

src/softnet/client/MultiServiceGroup.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ public boolean equals(Object other)
566566
@Override
567567
public int hashCode()
568568
{
569-
return Long.hashCode(this.serviceId);
569+
return (int)(this.serviceId ^ (this.serviceId>>>32));
570570
}
571571
}
572572
}

src/softnet/client/SLEventController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import softnet.core.*;
2525
import softnet.exceptions.*;
2626

27-
public class SLEventController implements EventController
27+
class SLEventController implements EventController
2828
{
2929
public SLEventController(ClientEndpoint clientEndpoint, ClientURI clientURI)
3030
{

src/softnet/client/StateController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import softnet.core.*;
2121
import softnet.exceptions.*;
2222

23-
public class StateController
23+
class StateController
2424
{
2525
public StateController(EndpointConnector endpointConnector, Object endpoint_mutex)
2626
{

src/softnet/client/UDPConnectorV4.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ private void udpExecute()
226226
while(connectorState != ConnectorState.COMPLETED)
227227
{
228228
try {
229-
packet.setLength(18);
229+
packet.setData(data);
230230
dgmSocket.receive(packet);
231231

232232
if(packet.getLength() == 17)

src/softnet/client/UDPConnectorV6.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ private void udpExecute()
223223
while(connectorState != ConnectorState.COMPLETED)
224224
{
225225
try {
226-
packet.setLength(18);
226+
packet.setData(data);
227227
dgmSocket.receive(packet);
228228

229229
if(packet.getLength() == 17)

src/softnet/core/MsgSocket.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ private void inputCircle()
100100
return;
101101
}
102102

103-
m_buffer.flip();
103+
((java.nio.Buffer)m_buffer).flip();
104104

105105
while (isClosed == false)
106106
{
@@ -140,7 +140,7 @@ else if(firstByte < 0)
140140
if(messageLength == m_buffer.remaining())
141141
{
142142
m_buffer.get(m_message);
143-
m_buffer.clear();
143+
((java.nio.Buffer)m_buffer).clear();
144144

145145
messageReceivedHandler.accept(m_message);
146146
m_message = null;
@@ -157,7 +157,7 @@ else if(messageLength < m_buffer.remaining())
157157
{
158158
messageBytesReceived = m_buffer.remaining();
159159
m_buffer.get(m_message, 0, messageBytesReceived);
160-
m_buffer.clear();
160+
((java.nio.Buffer)m_buffer).clear();
161161

162162
isReadingAtMessageOrigin = false;
163163
break;
@@ -169,7 +169,7 @@ else if(messageLength < m_buffer.remaining())
169169
if(messageBytesRequired == m_buffer.remaining())
170170
{
171171
m_buffer.get(m_message, messageBytesReceived, messageBytesRequired);
172-
m_buffer.clear();
172+
((java.nio.Buffer)m_buffer).clear();
173173

174174
messageReceivedHandler.accept(m_message);
175175
m_message = null;
@@ -181,7 +181,7 @@ else if(messageBytesRequired > m_buffer.remaining())
181181
{
182182
int bytesReceived = m_buffer.remaining();
183183
m_buffer.get(m_message, messageBytesReceived, bytesReceived);
184-
m_buffer.clear();
184+
((java.nio.Buffer)m_buffer).clear();
185185

186186
messageBytesReceived = messageBytesReceived + bytesReceived;
187187
break;

0 commit comments

Comments
 (0)