Code example for Parcel

Methods: readByte, readByteArray, readInt

0
        } 
    } 
 
    public static final Parcelable.Creator<DesfireFileSettings> CREATOR = new Parcelable.Creator<DesfireFileSettings>() {
        public DesfireFileSettings createFromParcel(Parcel source) { 
            byte fileType       = source.readByte(); 
            byte commSetting    = source.readByte(); 
            byte[] accessRights = new byte[source.readInt()]; 
            source.readByteArray(accessRights); 
 
            if (fileType == STANDARD_DATA_FILE || fileType == BACKUP_DATA_FILE) { 
                int fileSize = source.readInt(); 
                return new StandardDesfireFileSettings(fileType, commSetting, accessRights, fileSize); 
            } else if (fileType == LINEAR_RECORD_FILE || fileType == CYCLIC_RECORD_FILE) { 
                int recordSize = source.readInt(); 
                int maxRecords = source.readInt(); 
                int curRecords = source.readInt(); 
                return new RecordDesfireFileSettings(fileType, commSetting, accessRights, recordSize, maxRecords, curRecords); 
            } else { 
                return new UnsupportedDesfireFileSettings(fileType); 
            } 
        }