1/*
2** Copyright 2007, The Android Open Source Project
3**
4** Licensed under the Apache License, Version 2.0 (the "License");
5** you may not use this file except in compliance with the License.
6** You may obtain a copy of the License at
7**
8**     http://www.apache.org/licenses/LICENSE-2.0
9**
10** Unless required by applicable law or agreed to in writing, software
11** distributed under the License is distributed on an "AS IS" BASIS,
12** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13** See the License for the specific language governing permissions and
14** limitations under the License.
15*/
16
17
18package com.android.internal.telephony;
19
20import android.os.Parcel;
21import android.os.Parcelable;
22
23/**
24 *  A parcelable holder class of byte[] for ISms aidl implementation
25 */
26public class SmsRawData implements Parcelable {
27    byte[] data;
28
29    //Static Methods
30    public static final Parcelable.Creator<SmsRawData> CREATOR
31            = new Parcelable.Creator<SmsRawData> (){
32        public SmsRawData createFromParcel(Parcel source) {
33            int size;
34            size = source.readInt();
35            byte[] data = new byte[size];
36            source.readByteArray(data);
37            return new SmsRawData(data);
38        }
39
40        public SmsRawData[] newArray(int size) {
41            return new SmsRawData[size];
42        }
43    };
44
45    // Constructor
46    public SmsRawData(byte[] data) {
47        this.data = data;
48    }
49
50    public byte[] getBytes() {
51        return data;
52    }
53
54    public int describeContents() {
55        return 0;
56    }
57
58    public void writeToParcel(Parcel dest, int flags) {
59        dest.writeInt(data.length);
60        dest.writeByteArray(data);
61    }
62}
63