Added debugging statement when sending an object

This commit is contained in:
delvh 2020-06-09 18:18:13 +02:00 committed by kske
parent 5ea896d52b
commit 05f4fd33f5
1 changed files with 5 additions and 3 deletions

View File

@ -37,14 +37,16 @@ public class ObjectWriteProxy {
*/
public void write(long recipientSocketID, Object obj) throws IOException {
// Create message targeted at the client
Message response = writeProxy.getMessage();
final Message response = writeProxy.getMessage();
response.socketId = recipientSocketID;
System.out.println("Sending object " + obj);
// Serialize object to byte array
byte[] objBytes = SerializationUtils.writeToByteArray(obj);
final byte[] objBytes = SerializationUtils.writeToByteArray(obj);
// Acquire object length in bytes
byte[] objLen = SerializationUtils.intToBytes(objBytes.length);
final byte[] objLen = SerializationUtils.intToBytes(objBytes.length);
response.writeToMessage(objLen);
response.writeToMessage(objBytes);