aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2015-09-16 22:57:49 +0200
committerVincent Breitmoser <valodim@mugenguild.com>2015-09-16 22:57:49 +0200
commit0ba25696981a4c4d5aef01e4a1d683c8adf7522a (patch)
treede4f683cbef415f5c81c6145ede96be8774e6aee
parent13492ba19fcc1767f5589227b8fa0a9c845696d4 (diff)
downloadopenpgp-api-0ba25696981a4c4d5aef01e4a1d683c8adf7522a.tar.gz
openpgp-api-0ba25696981a4c4d5aef01e4a1d683c8adf7522a.tar.bz2
openpgp-api-0ba25696981a4c4d5aef01e4a1d683c8adf7522a.zip
add charset to OpenPgpMetadata parcel
-rw-r--r--openpgp-api/src/main/java/org/openintents/openpgp/OpenPgpMetadata.java24
1 files changed, 22 insertions, 2 deletions
diff --git a/openpgp-api/src/main/java/org/openintents/openpgp/OpenPgpMetadata.java b/openpgp-api/src/main/java/org/openintents/openpgp/OpenPgpMetadata.java
index 8b3a3bb..0d766c7 100644
--- a/openpgp-api/src/main/java/org/openintents/openpgp/OpenPgpMetadata.java
+++ b/openpgp-api/src/main/java/org/openintents/openpgp/OpenPgpMetadata.java
@@ -25,10 +25,11 @@ public class OpenPgpMetadata implements Parcelable {
* old versions of the protocol (and thus old versions of this class), we need a versioning
* system for the parcels sent between the clients and the providers.
*/
- public static final int PARCELABLE_VERSION = 1;
+ public static final int PARCELABLE_VERSION = 2;
String filename;
String mimeType;
+ String charset;
long modificationTime;
long originalSize;
@@ -48,10 +49,23 @@ public class OpenPgpMetadata implements Parcelable {
return originalSize;
}
+ public String getCharset() {
+ return charset;
+ }
+
public OpenPgpMetadata() {
}
public OpenPgpMetadata(String filename, String mimeType, long modificationTime,
+ long originalSize, String charset) {
+ this.filename = filename;
+ this.mimeType = mimeType;
+ this.modificationTime = modificationTime;
+ this.originalSize = originalSize;
+ this.charset = charset;
+ }
+
+ public OpenPgpMetadata(String filename, String mimeType, long modificationTime,
long originalSize) {
this.filename = filename;
this.mimeType = mimeType;
@@ -86,6 +100,8 @@ public class OpenPgpMetadata implements Parcelable {
dest.writeString(mimeType);
dest.writeLong(modificationTime);
dest.writeLong(originalSize);
+ // version 2
+ dest.writeString(charset);
// Go back and write the size
int parcelableSize = dest.dataPosition() - startPosition;
dest.setDataPosition(sizePosition);
@@ -95,7 +111,7 @@ public class OpenPgpMetadata implements Parcelable {
public static final Creator<OpenPgpMetadata> CREATOR = new Creator<OpenPgpMetadata>() {
public OpenPgpMetadata createFromParcel(final Parcel source) {
- source.readInt(); // parcelableVersion
+ int version = source.readInt(); // parcelableVersion
int parcelableSize = source.readInt();
int startPosition = source.dataPosition();
@@ -104,6 +120,9 @@ public class OpenPgpMetadata implements Parcelable {
vr.mimeType = source.readString();
vr.modificationTime = source.readLong();
vr.originalSize = source.readLong();
+ if (version >= 2) {
+ vr.charset = source.readString();
+ }
// skip over all fields added in future versions of this parcel
source.setDataPosition(startPosition + parcelableSize);
@@ -122,6 +141,7 @@ public class OpenPgpMetadata implements Parcelable {
out += "\nmimeType: " + mimeType;
out += "\nmodificationTime: " + modificationTime;
out += "\noriginalSize: " + originalSize;
+ out += "\ncharset: " + charset;
return out;
}