Add server side contact deletion

This commit is contained in:
2020-10-10 22:25:39 +02:00
committed by KSKE Git
parent 12184848b6
commit a515ec961a
9 changed files with 122 additions and 20 deletions

View File

@ -0,0 +1,15 @@
package envoy.event.contact;
import envoy.event.Event.Valueless;
/**
* Conveys that either a direct contact or a group member has been deleted while
* the user has been offline.
*
* @author Leon Hofmeister
* @since Envoy Common v0.3-beta
*/
public class ContactDeletionSinceLastLogin extends Valueless {
private static final long serialVersionUID = 1L;
}

View File

@ -105,7 +105,7 @@ public final class SerializationUtils {
file.createNewFile();
}
try (ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(file))) {
for (var obj : objs)
for (final var obj : objs)
out.writeObject(obj);
}
}
@ -119,7 +119,7 @@ public final class SerializationUtils {
* @since Envoy Common v0.2-alpha
*/
public static byte[] writeToByteArray(Object obj) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
final var baos = new ByteArrayOutputStream();
try (ObjectOutputStream oout = new ObjectOutputStream(baos)) {
oout.writeObject(obj);
}
@ -137,10 +137,10 @@ public final class SerializationUtils {
*/
public static void writeBytesWithLength(Object obj, OutputStream out) throws IOException {
// Serialize object to byte array
byte[] objBytes = writeToByteArray(obj);
final var objBytes = writeToByteArray(obj);
// Get length of byte array in bytes
byte[] objLen = intToBytes(objBytes.length);
final var objLen = intToBytes(objBytes.length);
// Write length and byte array
out.write(objLen);