org.whispersystems.signalservice.api.messages.SignalServiceAttachmentPointer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of signal-service-java Show documentation
Show all versions of signal-service-java Show documentation
Signal Service communication library for Java
/*
* Copyright (C) 2014-2017 Open Whisper Systems
*
* Licensed according to the LICENSE file in this repository.
*/
package org.whispersystems.signalservice.api.messages;
import org.whispersystems.libsignal.util.guava.Optional;
import org.whispersystems.signalservice.api.SignalServiceMessageReceiver;
/**
* Represents a received SignalServiceAttachment "handle." This
* is a pointer to the actual attachment content, which needs to be
* retrieved using {@link SignalServiceMessageReceiver#retrieveAttachment(SignalServiceAttachmentPointer, java.io.File, int)}
*
* @author Moxie Marlinspike
*/
public class SignalServiceAttachmentPointer extends SignalServiceAttachment {
private final long id;
private final byte[] key;
private final Optional relay;
private final Optional size;
private final Optional preview;
private final Optional digest;
private final Optional fileName;
private final boolean voiceNote;
private final int width;
private final int height;
public SignalServiceAttachmentPointer(long id, String contentType, byte[] key, String relay,
Optional size, Optional preview,
int width, int height,
Optional digest, Optional fileName,
boolean voiceNote)
{
super(contentType);
this.id = id;
this.key = key;
this.relay = Optional.fromNullable(relay);
this.size = size;
this.preview = preview;
this.width = width;
this.height = height;
this.digest = digest;
this.fileName = fileName;
this.voiceNote = voiceNote;
}
public long getId() {
return id;
}
public byte[] getKey() {
return key;
}
@Override
public boolean isStream() {
return false;
}
@Override
public boolean isPointer() {
return true;
}
public Optional getRelay() {
return relay;
}
public Optional getSize() {
return size;
}
public Optional getFileName() {
return fileName;
}
public Optional getPreview() {
return preview;
}
public Optional getDigest() {
return digest;
}
public boolean getVoiceNote() {
return voiceNote;
}
public int getWidth() {
return width;
}
public int getHeight() {
return height;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy