ObbInfo.java revision 38cf8867a8d3e8d5159abd0bd0e6a3b0b8348b94
1/* 2 * Copyright (C) 2010 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 17package android.content.res; 18 19import android.os.Parcel; 20import android.os.Parcelable; 21 22/** 23 * Basic information about a Opaque Binary Blob (OBB) that reflects the info 24 * from the footer on the OBB file. This information may be manipulated by a 25 * developer with the <code>obbtool</code> program in the Android SDK. 26 */ 27public class ObbInfo implements Parcelable { 28 /** Flag noting that this OBB is an overlay patch for a base OBB. */ 29 public static final int OBB_OVERLAY = 1 << 0; 30 31 /** 32 * The canonical filename of the OBB. 33 */ 34 public String filename; 35 36 /** 37 * The name of the package to which the OBB file belongs. 38 */ 39 public String packageName; 40 41 /** 42 * The version of the package to which the OBB file belongs. 43 */ 44 public int version; 45 46 /** 47 * The flags relating to the OBB. 48 */ 49 public int flags; 50 51 // Only allow things in this package to instantiate. 52 /* package */ ObbInfo() { 53 } 54 55 public String toString() { 56 StringBuilder sb = new StringBuilder(); 57 sb.append("ObbInfo{"); 58 sb.append(Integer.toHexString(System.identityHashCode(this))); 59 sb.append(" packageName="); 60 sb.append(packageName); 61 sb.append(",version="); 62 sb.append(version); 63 sb.append(",flags="); 64 sb.append(flags); 65 sb.append('}'); 66 return sb.toString(); 67 } 68 69 public int describeContents() { 70 return 0; 71 } 72 73 public void writeToParcel(Parcel dest, int parcelableFlags) { 74 dest.writeString(filename); 75 dest.writeString(packageName); 76 dest.writeInt(version); 77 dest.writeInt(flags); 78 } 79 80 public static final Parcelable.Creator<ObbInfo> CREATOR 81 = new Parcelable.Creator<ObbInfo>() { 82 public ObbInfo createFromParcel(Parcel source) { 83 return new ObbInfo(source); 84 } 85 86 public ObbInfo[] newArray(int size) { 87 return new ObbInfo[size]; 88 } 89 }; 90 91 private ObbInfo(Parcel source) { 92 filename = source.readString(); 93 packageName = source.readString(); 94 version = source.readInt(); 95 flags = source.readInt(); 96 } 97} 98