Added ability to save attachments

This commit is contained in:
delvh
2020-07-27 12:00:49 +02:00
parent 9584960edc
commit 91be1db393
5 changed files with 81 additions and 24 deletions

View File

@ -18,29 +18,28 @@ 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,
@ -55,19 +54,22 @@ public class Attachment implements Serializable {
private final byte[] data;
private final AttachmentType type;
private final String name;
private static final long serialVersionUID = 1L;
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, AttachmentType type) {
public Attachment(byte[] data, String name, AttachmentType type) {
this.data = data;
this.type = type;
this.name = name;
}
/**
@ -81,4 +83,10 @@ public class Attachment implements Serializable {
* @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; }
}