Added debugging statement when sending an object

This commit is contained in:
delvh 2020-06-09 18:18:13 +02:00 committed by CyB3RC0nN0R
parent e8b59761a7
commit 90103d5c49

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);