Add server side contact deletion
This commit is contained in:
		@@ -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;
 | 
			
		||||
}
 | 
			
		||||
@@ -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);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user