summaryrefslogtreecommitdiffstats
path: root/src/de/thedevstack/smackx/filetransferhttp/element/RemoteFile.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/de/thedevstack/smackx/filetransferhttp/element/RemoteFile.java')
-rw-r--r--src/de/thedevstack/smackx/filetransferhttp/element/RemoteFile.java79
1 files changed, 79 insertions, 0 deletions
diff --git a/src/de/thedevstack/smackx/filetransferhttp/element/RemoteFile.java b/src/de/thedevstack/smackx/filetransferhttp/element/RemoteFile.java
new file mode 100644
index 0000000..483d8b3
--- /dev/null
+++ b/src/de/thedevstack/smackx/filetransferhttp/element/RemoteFile.java
@@ -0,0 +1,79 @@
+package de.thedevstack.smackx.filetransferhttp.element;
+
+import org.jivesoftware.smack.packet.NamedElement;
+import org.jivesoftware.smack.util.XmlStringBuilder;
+
+public class RemoteFile implements NamedElement {
+ private String url;
+ private long timestamp;
+ private RemoteFileInfo fileInfo;
+ private String from;
+ private String to;
+
+ public RemoteFile(String url, long timestamp) {
+ this.url = url;
+ this.timestamp = timestamp;
+ }
+
+ public String getFilename() {
+ return (null != fileInfo) ? fileInfo.getFilename() : null;
+ }
+
+ public long getSize() {
+ return (null != fileInfo) ? fileInfo.getSize() : -1;
+ }
+
+ public String getContentType() {
+ return (null != fileInfo) ? fileInfo.getContentType() : null;
+ }
+
+ public RemoteFileInfo getFileInfo() {
+ return fileInfo;
+ }
+
+ public void setFileInfo(RemoteFileInfo fileInfo) {
+ this.fileInfo = fileInfo;
+ }
+
+ public String getFrom() {
+ return from;
+ }
+
+ public void setFrom(String from) {
+ this.from = from;
+ }
+
+ public String getTo() {
+ return to;
+ }
+
+ public void setTo(String to) {
+ this.to = to;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public long getTimestamp() {
+ return timestamp;
+ }
+
+ @Override
+ public String getElementName() {
+ return "file";
+ }
+
+ @Override
+ public CharSequence toXML() {
+ XmlStringBuilder xml = new XmlStringBuilder(this);
+ xml.attribute("timestamp", String.valueOf(this.timestamp));
+ xml.optAttribute("from", this.from);
+ xml.optAttribute("to", this.to);
+ xml.rightAngleBracket();
+ xml.element("url", this.url);
+ xml.append(fileInfo.toXML());
+ xml.closeElement(this);
+ return xml;
+ }
+}