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

89 lines
1.7 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).
*
* @author Leon Hofmeister
* @author Kai S. K. Engelbart
* @since Envoy Common v0.2-alpha
*/
public final 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 final String name;
private static final long serialVersionUID = 2L;
/**
* Constructs an attachment.
*
* @param data the data of the attachment
* @param name the name of the attachment
* @param type the type of the attachment
* @since Envoy Common v0.1-beta
*/
public Attachment(byte[] data, String name, AttachmentType type) {
this.data = data;
this.name = name;
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; }
/**
* @return the name
* @since Envoy Common v0.2-beta
*/
public String getName() { return name; }
}