Moved classes related to java-nio-server to envoy.server.net package.

This commit is contained in:
Kai S. K. Engelbart 2020-01-03 16:40:43 +02:00
parent 9318201fd5
commit 10a387beea
3 changed files with 12 additions and 7 deletions

View File

@ -6,6 +6,9 @@ import java.util.Set;
import com.jenkov.nioserver.Server;
import envoy.server.net.ObjectMessageProcessor;
import envoy.server.net.ObjectMessageReader;
/**
* Starts the server.<br>
* <br>

View File

@ -1,4 +1,4 @@
package envoy.server;
package envoy.server.net;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@ -11,6 +11,8 @@ import com.jenkov.nioserver.IMessageProcessor;
import com.jenkov.nioserver.Message;
import com.jenkov.nioserver.WriteProxy;
import envoy.server.ObjectProcessor;
/**
* Handles incoming objects.<br>
* <br>

View File

@ -1,4 +1,4 @@
package envoy.server;
package envoy.server.net;
import java.io.IOException;
import java.nio.ByteBuffer;
@ -26,11 +26,6 @@ public class ObjectMessageReader implements IMessageReader {
private Message nextMessage;
private MessageBuffer messageBuffer;
private int fromByteArray(byte[] bytes, int offset) {
return ((bytes[offset] & 0xFF) << 24) | ((bytes[offset + 1] & 0xFF) << 16) | ((bytes[offset + 2] & 0xFF) << 8)
| ((bytes[offset + 3] & 0xFF) << 0);
}
@Override
public List<Message> getMessages() { return completeMessages; }
@ -65,4 +60,9 @@ public class ObjectMessageReader implements IMessageReader {
buffer.clear();
}
private int fromByteArray(byte[] bytes, int offset) {
return ((bytes[offset] & 0xFF) << 24) | ((bytes[offset + 1] & 0xFF) << 16) | ((bytes[offset + 2] & 0xFF) << 8)
| ((bytes[offset + 3] & 0xFF) << 0);
}
}