aboutsummaryrefslogtreecommitdiffstats
path: root/openpgp-ktx/src/main/java/org/openintents/openpgp/OpenPgpMetadata.kt
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2021-03-09 14:53:11 +0530
committerHarsh Shandilya <me@msfjarvis.dev>2021-03-18 11:40:30 +0530
commit774fda83ac276a635e3402034b1eedbd10be916f (patch)
tree57783a953fcd193d32f1e3dc8df26e07f03df328 /openpgp-ktx/src/main/java/org/openintents/openpgp/OpenPgpMetadata.kt
parentbe31ae37f443982b377d027cd613f04d0926568d (diff)
downloadHardenedPass-774fda83ac276a635e3402034b1eedbd10be916f.tar.gz
HardenedPass-774fda83ac276a635e3402034b1eedbd10be916f.zip
all: reformat with ktfmt
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
Diffstat (limited to 'openpgp-ktx/src/main/java/org/openintents/openpgp/OpenPgpMetadata.kt')
-rw-r--r--openpgp-ktx/src/main/java/org/openintents/openpgp/OpenPgpMetadata.kt187
1 files changed, 91 insertions, 96 deletions
diff --git a/openpgp-ktx/src/main/java/org/openintents/openpgp/OpenPgpMetadata.kt b/openpgp-ktx/src/main/java/org/openintents/openpgp/OpenPgpMetadata.kt
index 81b200e1..b590456a 100644
--- a/openpgp-ktx/src/main/java/org/openintents/openpgp/OpenPgpMetadata.kt
+++ b/openpgp-ktx/src/main/java/org/openintents/openpgp/OpenPgpMetadata.kt
@@ -12,111 +12,106 @@ import android.os.Parcelable.Creator
public class OpenPgpMetadata() : Parcelable {
- public var filename: String? = null
- public var mimeType: String? = null
- public var charset: String? = null
- public var modificationTime: Long = 0
- public var originalSize: Long = 0
+ public var filename: String? = null
+ public var mimeType: String? = null
+ public var charset: String? = null
+ public var modificationTime: Long = 0
+ public var originalSize: Long = 0
- private constructor(
- filename: String?,
- mimeType: String?,
- modificationTime: Long,
- originalSize: Long,
- charset: String?
- ) : this() {
- this.filename = filename
- this.mimeType = mimeType
- this.modificationTime = modificationTime
- this.originalSize = originalSize
- this.charset = charset
- }
+ private constructor(
+ filename: String?,
+ mimeType: String?,
+ modificationTime: Long,
+ originalSize: Long,
+ charset: String?
+ ) : this() {
+ this.filename = filename
+ this.mimeType = mimeType
+ this.modificationTime = modificationTime
+ this.originalSize = originalSize
+ this.charset = charset
+ }
- private constructor(
- filename: String?,
- mimeType: String?,
- modificationTime: Long,
- originalSize: Long
- ) : this() {
- this.filename = filename
- this.mimeType = mimeType
- this.modificationTime = modificationTime
- this.originalSize = originalSize
- }
+ private constructor(filename: String?, mimeType: String?, modificationTime: Long, originalSize: Long) : this() {
+ this.filename = filename
+ this.mimeType = mimeType
+ this.modificationTime = modificationTime
+ this.originalSize = originalSize
+ }
- private constructor(b: OpenPgpMetadata) : this() {
- filename = b.filename
- mimeType = b.mimeType
- modificationTime = b.modificationTime
- originalSize = b.originalSize
- }
+ private constructor(b: OpenPgpMetadata) : this() {
+ filename = b.filename
+ mimeType = b.mimeType
+ modificationTime = b.modificationTime
+ originalSize = b.originalSize
+ }
- override fun describeContents(): Int {
- return 0
- }
+ override fun describeContents(): Int {
+ return 0
+ }
- override fun writeToParcel(dest: Parcel, flags: Int) {
- /**
- * NOTE: When adding fields in the process of updating this API, make sure to bump
- * [PARCELABLE_VERSION].
- */
- dest.writeInt(PARCELABLE_VERSION)
- // Inject a placeholder that will store the parcel size from this point on
- // (not including the size itself).
- val sizePosition = dest.dataPosition()
- dest.writeInt(0)
- val startPosition = dest.dataPosition()
- // version 1
- dest.writeString(filename)
- dest.writeString(mimeType)
- dest.writeLong(modificationTime)
- dest.writeLong(originalSize)
- // version 2
- dest.writeString(charset)
- // Go back and write the size
- val parcelableSize = dest.dataPosition() - startPosition
- dest.setDataPosition(sizePosition)
- dest.writeInt(parcelableSize)
- dest.setDataPosition(startPosition + parcelableSize)
- }
-
- public companion object CREATOR : Creator<OpenPgpMetadata> {
+ override fun writeToParcel(dest: Parcel, flags: Int) {
+ /**
+ * NOTE: When adding fields in the process of updating this API, make sure to bump
+ * [PARCELABLE_VERSION].
+ */
+ dest.writeInt(PARCELABLE_VERSION)
+ // Inject a placeholder that will store the parcel size from this point on
+ // (not including the size itself).
+ val sizePosition = dest.dataPosition()
+ dest.writeInt(0)
+ val startPosition = dest.dataPosition()
+ // version 1
+ dest.writeString(filename)
+ dest.writeString(mimeType)
+ dest.writeLong(modificationTime)
+ dest.writeLong(originalSize)
+ // version 2
+ dest.writeString(charset)
+ // Go back and write the size
+ val parcelableSize = dest.dataPosition() - startPosition
+ dest.setDataPosition(sizePosition)
+ dest.writeInt(parcelableSize)
+ dest.setDataPosition(startPosition + parcelableSize)
+ }
- /**
- * Since there might be a case where new versions of the client using the library getting
- * 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.
- */
- private const val PARCELABLE_VERSION = 2
+ public companion object CREATOR : Creator<OpenPgpMetadata> {
- override fun createFromParcel(source: Parcel): OpenPgpMetadata? {
- val version = source.readInt() // parcelableVersion
- val parcelableSize = source.readInt()
- val startPosition = source.dataPosition()
- val vr = OpenPgpMetadata()
- vr.filename = source.readString()
- 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)
- return vr
- }
+ /**
+ * Since there might be a case where new versions of the client using the library getting 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.
+ */
+ private const val PARCELABLE_VERSION = 2
- override fun newArray(size: Int): Array<OpenPgpMetadata?> {
- return arrayOfNulls(size)
- }
+ override fun createFromParcel(source: Parcel): OpenPgpMetadata? {
+ val version = source.readInt() // parcelableVersion
+ val parcelableSize = source.readInt()
+ val startPosition = source.dataPosition()
+ val vr = OpenPgpMetadata()
+ vr.filename = source.readString()
+ 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)
+ return vr
}
- override fun toString(): String {
- var out = "\nfilename: $filename"
- out += "\nmimeType: $mimeType"
- out += "\nmodificationTime: $modificationTime"
- out += "\noriginalSize: $originalSize"
- out += "\ncharset: $charset"
- return out
+ override fun newArray(size: Int): Array<OpenPgpMetadata?> {
+ return arrayOfNulls(size)
}
+ }
+
+ override fun toString(): String {
+ var out = "\nfilename: $filename"
+ out += "\nmimeType: $mimeType"
+ out += "\nmodificationTime: $modificationTime"
+ out += "\noriginalSize: $originalSize"
+ out += "\ncharset: $charset"
+ return out
+ }
}