184ef3f95a4e6d1c5156223f948f26492041f8cc
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 public class RemoteFile
implements Parcelable
, Serializable
{
13 /** Generated - should be refreshed every time the class changes!! */
14 private static final long serialVersionUID
= 7256606476031992757L;
16 private String mRemotePath
;
17 private String mMimeType
;
19 private long mCreationTimestamp
;
20 private long mModifiedTimestamp
;
27 public String
getRemotePath() {
31 public void setRemotePath(String remotePath
) {
32 this.mRemotePath
= remotePath
;
35 public String
getMimeType() {
39 public void setMimeType(String mimeType
) {
40 this.mMimeType
= mimeType
;
43 public long getLength() {
47 public void setLength(long length
) {
48 this.mLength
= length
;
51 public long getCreationTimestamp() {
52 return mCreationTimestamp
;
55 public void setCreationTimestamp(long creationTimestamp
) {
56 this.mCreationTimestamp
= creationTimestamp
;
59 public long getModifiedTimestamp() {
60 return mModifiedTimestamp
;
63 public void setModifiedTimestamp(long modifiedTimestamp
) {
64 this.mModifiedTimestamp
= modifiedTimestamp
;
67 public String
getEtag() {
71 public void setEtag(String etag
) {
76 * Create new {@link RemoteFile} with given path.
78 * The path received must be URL-decoded. Path separator must be OCFile.PATH_SEPARATOR, and it must be the first character in 'path'.
80 * @param path The remote path of the file.
82 public RemoteFile(String path
) {
84 if (path
== null
|| path
.length() <= 0 || !path
.startsWith(FileUtils
.PATH_SEPARATOR
)) {
85 throw new IllegalArgumentException("Trying to create a OCFile with a non valid remote path: " + path
);
91 * Used internally. Reset all file properties
93 private void resetData() {
97 mCreationTimestamp
= 0;
98 mModifiedTimestamp
= 0;
105 public static final Parcelable
.Creator
<RemoteFile
> CREATOR
= new Parcelable
.Creator
<RemoteFile
>() {
107 public RemoteFile
createFromParcel(Parcel source
) {
108 return new RemoteFile(source
);
112 public RemoteFile
[] newArray(int size
) {
113 return new RemoteFile
[size
];
119 * Reconstruct from parcel
121 * @param source The source parcel
123 private RemoteFile(Parcel source
) {
124 mRemotePath
= source
.readString();
125 mMimeType
= source
.readString();
126 mLength
= source
.readLong();
127 mCreationTimestamp
= source
.readLong();
128 mModifiedTimestamp
= source
.readLong();
129 mEtag
= source
.readString();
133 public int describeContents() {
134 return this.hashCode();
138 public void writeToParcel(Parcel dest
, int flags
) {
139 dest
.writeString(mRemotePath
);
140 dest
.writeString(mMimeType
);
141 dest
.writeLong(mLength
);
142 dest
.writeLong(mCreationTimestamp
);
143 dest
.writeLong(mModifiedTimestamp
);
144 dest
.writeString(mEtag
);