This repository has been archived on 2021-12-05. You can view files and clone it, but cannot push or open issues or pull requests.
envoy/common/src/main/java/envoy/data/Attachment.java

85 lines
1.6 KiB
Java

package envoy.data;
import java.io.Serializable;
/**
* This interface should be used for any type supposed to be a {@link Message}
* attachment (i.e. images or sound).
* <p>
* Project: <strong>envoy-common</strong><br>
* File: <strong>Attachment.java</strong><br>
* Created: <strong>30 Dec 2019</strong><br>
*
* @author Leon Hofmeister
* @author Kai S. K. Engelbart
* @since Envoy Common v0.2-alpha
*/
public class Attachment implements Serializable {
/**
* Defines the type of the attachment.
*
* @since Envoy Common v0.1-beta
*/
public enum AttachmentType {
/**
* This attachment type denotes a picture.
*
* @since Envoy Common v0.1-beta
*/
PICTURE,
/**
* This attachment type denotes a video.
*
* @since Envoy Common v0.1-beta
*/
VIDEO,
/**
* This attachment type denotes a voice message.
*
* @since Envoy Common v0.1-beta
*/
VOICE,
/**
* This attachment type denotes a document.
*
* @since Envoy Common v0.1-beta
*/
DOCUMENT
}
private final byte[] data;
private final AttachmentType type;
private static final long serialVersionUID = 1L;
/**
* Constructs an attachment.
*
* @param data the data of the attachment
* @param type the type of the attachment
* @since Envoy Common v0.1-beta
*/
public Attachment(byte[] data, AttachmentType type) {
this.data = data;
this.type = type;
}
/**
* @return the data of the attachment
* @since Envoy Common v0.1-beta
*/
public byte[] getData() { return data; }
/**
* @return the type of the attachment
* @since Envoy Common v0.1-beta
*/
public AttachmentType getType() { return type; }
}