Network.java revision 9ba9c58e4a249456794fbfb9989f27bd846d067e
1/* 2 * Copyright (C) 2014 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.net; 18 19import android.os.Parcelable; 20import android.os.Parcel; 21 22 23/** 24 * Identifies the Network. 25 * @hide 26 */ 27public class Network implements Parcelable { 28 29 public final int netId; 30 31 public Network(int netId) { 32 this.netId = netId; 33 } 34 35 public Network(Network that) { 36 this.netId = that.netId; 37 } 38 39 // implement the Parcelable interface 40 public int describeContents() { 41 return 0; 42 } 43 public void writeToParcel(Parcel dest, int flags) { 44 dest.writeInt(netId); 45 } 46 47 public static final Creator<Network> CREATOR = 48 new Creator<Network>() { 49 public Network createFromParcel(Parcel in) { 50 int netId = in.readInt(); 51 52 return new Network(netId); 53 } 54 55 public Network[] newArray(int size) { 56 return new Network[size]; 57 } 58 }; 59} 60