2c1920f000b41d7033113e2fb546e81ff8474897
1 package com
.owncloud
.android
.oc_framework
.operations
;
3 import java
.io
.Serializable
;
5 import android
.os
.Parcel
;
6 import android
.os
.Parcelable
;
8 import com
.owncloud
.android
.oc_framework
.utils
.FileUtils
;
11 * Contains the data of a Remote File from a WebDavEntry
16 public class RemoteFile
implements Parcelable
, Serializable
{
18 /** Generated - should be refreshed every time the class changes!! */
19 private static final long serialVersionUID
= 7256606476031992757L;
21 private String mRemotePath
;
22 private String mMimeType
;
24 private long mCreationTimestamp
;
25 private long mModifiedTimestamp
;
32 public String
getRemotePath() {
36 public void setRemotePath(String remotePath
) {
37 this.mRemotePath
= remotePath
;
40 public String
getMimeType() {
44 public void setMimeType(String mimeType
) {
45 this.mMimeType
= mimeType
;
48 public long getLength() {
52 public void setLength(long length
) {
53 this.mLength
= length
;
56 public long getCreationTimestamp() {
57 return mCreationTimestamp
;
60 public void setCreationTimestamp(long creationTimestamp
) {
61 this.mCreationTimestamp
= creationTimestamp
;
64 public long getModifiedTimestamp() {
65 return mModifiedTimestamp
;
68 public void setModifiedTimestamp(long modifiedTimestamp
) {
69 this.mModifiedTimestamp
= modifiedTimestamp
;
72 public String
getEtag() {
76 public void setEtag(String etag
) {
81 * Create new {@link RemoteFile} with given path.
83 * The path received must be URL-decoded. Path separator must be OCFile.PATH_SEPARATOR, and it must be the first character in 'path'.
85 * @param path The remote path of the file.
87 public RemoteFile(String path
) {
89 if (path
== null
|| path
.length() <= 0 || !path
.startsWith(FileUtils
.PATH_SEPARATOR
)) {
90 throw new IllegalArgumentException("Trying to create a OCFile with a non valid remote path: " + path
);
96 * Used internally. Reset all file properties
98 private void resetData() {
102 mCreationTimestamp
= 0;
103 mModifiedTimestamp
= 0;
110 public static final Parcelable
.Creator
<RemoteFile
> CREATOR
= new Parcelable
.Creator
<RemoteFile
>() {
112 public RemoteFile
createFromParcel(Parcel source
) {
113 return new RemoteFile(source
);
117 public RemoteFile
[] newArray(int size
) {
118 return new RemoteFile
[size
];
124 * Reconstruct from parcel
126 * @param source The source parcel
128 private RemoteFile(Parcel source
) {
129 mRemotePath
= source
.readString();
130 mMimeType
= source
.readString();
131 mLength
= source
.readLong();
132 mCreationTimestamp
= source
.readLong();
133 mModifiedTimestamp
= source
.readLong();
134 mEtag
= source
.readString();
138 public int describeContents() {
139 return this.hashCode();
143 public void writeToParcel(Parcel dest
, int flags
) {
144 dest
.writeString(mRemotePath
);
145 dest
.writeString(mMimeType
);
146 dest
.writeLong(mLength
);
147 dest
.writeLong(mCreationTimestamp
);
148 dest
.writeLong(mModifiedTimestamp
);
149 dest
.writeString(mEtag
);