blob: 730862ec6f914216a2f87a0ba581386dac1b1a64 [file] [log] [blame]
Casper Bonde238e0f92015-04-09 09:24:48 +02001/*
2* Copyright (C) 2015 Samsung System LSI
3* Licensed under the Apache License, Version 2.0 (the "License");
4* you may not use this file except in compliance with the License.
5* You may obtain a copy of the License at
6*
7* http://www.apache.org/licenses/LICENSE-2.0
8*
9* Unless required by applicable law or agreed to in writing, software
10* distributed under the License is distributed on an "AS IS" BASIS,
11* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12* See the License for the specific language governing permissions and
13* limitations under the License.
14*/
15
16package android.bluetooth;
17
18import android.os.Parcel;
19import android.os.Parcelable;
20
21import java.util.Arrays;
22
23/** @hide */
Jack Hea355e5e2017-08-22 16:06:54 -070024public class SdpRecord implements Parcelable {
Casper Bonde238e0f92015-04-09 09:24:48 +020025
26 private final byte[] mRawData;
27 private final int mRawSize;
28
29 @Override
30 public String toString() {
31 return "BluetoothSdpRecord [rawData=" + Arrays.toString(mRawData)
32 + ", rawSize=" + mRawSize + "]";
33 }
34
Jack He2992cd02017-08-22 21:21:23 -070035 public SdpRecord(int sizeRecord, byte[] record) {
36 mRawData = record;
37 mRawSize = sizeRecord;
Casper Bonde238e0f92015-04-09 09:24:48 +020038 }
39
Jack Hea355e5e2017-08-22 16:06:54 -070040 public SdpRecord(Parcel in) {
Jack He2992cd02017-08-22 21:21:23 -070041 mRawSize = in.readInt();
42 mRawData = new byte[mRawSize];
43 in.readByteArray(mRawData);
Casper Bonde238e0f92015-04-09 09:24:48 +020044
45 }
46
47 @Override
48 public int describeContents() {
49 return 0;
50 }
51
52 @Override
53 public void writeToParcel(Parcel dest, int flags) {
Jack He2992cd02017-08-22 21:21:23 -070054 dest.writeInt(mRawSize);
55 dest.writeByteArray(mRawData);
Casper Bonde238e0f92015-04-09 09:24:48 +020056
57
58 }
Jack Hea355e5e2017-08-22 16:06:54 -070059
Casper Bonde238e0f92015-04-09 09:24:48 +020060 public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
61 public SdpRecord createFromParcel(Parcel in) {
62 return new SdpRecord(in);
63 }
64
65 public SdpRecord[] newArray(int size) {
66 return new SdpRecord[size];
67 }
68 };
69
70 public byte[] getRawData() {
71 return mRawData;
72 }
73
74 public int getRawSize() {
75 return mRawSize;
76 }
77}