Code example for Parcel

Methods: writeByte, writeByteArray, writeInt

0
            return new DesfireFileSettings[size]; 
        } 
    }; 
 
    public void writeToParcel (Parcel parcel, int flags) {
        parcel.writeByte(fileType);
        parcel.writeByte(commSetting);
        parcel.writeInt(accessRights.length);
        parcel.writeByteArray(accessRights);
    } 
 
    public int describeContents () { 
        return 0; 
    } 
 
    public static class StandardDesfireFileSettings extends DesfireFileSettings { 
        public final int fileSize;
 
        private StandardDesfireFileSettings (ByteArrayInputStream stream) {
            super(stream);
            byte[] buf = new byte[3];
            stream.read(buf, 0, buf.length);
            ArrayUtils.reverse(buf);
            fileSize = Utils.byteArrayToInt(buf);
        } 
 
        StandardDesfireFileSettings (byte fileType, byte commSetting, byte[] accessRights, int fileSize) {
            super(fileType, commSetting, accessRights);
            this.fileSize = fileSize;
        } 
 
        @Override 
        public void writeToParcel (Parcel parcel, int flags) {
            super.writeToParcel(parcel, flags);
            parcel.writeInt(fileSize);
        } 
    } 
 
    public static class RecordDesfireFileSettings extends DesfireFileSettings { 
        public final int recordSize;
        public final int maxRecords;
        public final int curRecords;
 
        public RecordDesfireFileSettings(ByteArrayInputStream stream) {
            super(stream);
 
            byte[] buf = new byte[3];
            stream.read(buf, 0, buf.length);
            ArrayUtils.reverse(buf);
            recordSize = Utils.byteArrayToInt(buf);
 
            buf = new byte[3];
            stream.read(buf, 0, buf.length);
            ArrayUtils.reverse(buf);
            maxRecords = Utils.byteArrayToInt(buf);
 
            buf = new byte[3];
            stream.read(buf, 0, buf.length);
            ArrayUtils.reverse(buf);
            curRecords = Utils.byteArrayToInt(buf);
        } 
 
        RecordDesfireFileSettings (byte fileType, byte commSetting, byte[] accessRights, int recordSize, int maxRecords, int curRecords) {
            super(fileType, commSetting, accessRights);
            this.recordSize = recordSize;
            this.maxRecords = maxRecords;
            this.curRecords = curRecords;
        } 
 
        @Override 
        public void writeToParcel (Parcel parcel, int flags) {
            super.writeToParcel(parcel, flags);
            parcel.writeInt(recordSize);
            parcel.writeInt(maxRecords);
            parcel.writeInt(curRecords);
        } 
    } 
 
    public static class UnsupportedDesfireFileSettings extends DesfireFileSettings { 
        public UnsupportedDesfireFileSettings(byte fileType) {