FileDocCategorySizeDatePackage
NetworkIdentitySet.javaAPI DocAndroid 5.1 API3488Thu Mar 12 22:22:42 GMT 2015com.android.server.net

NetworkIdentitySet

public class NetworkIdentitySet extends HashSet implements Comparable
Identity of a {@code iface}, defined by the set of {@link NetworkIdentity} active on that interface.
hide

Fields Summary
private static final int
VERSION_INIT
private static final int
VERSION_ADD_ROAMING
private static final int
VERSION_ADD_NETWORK_ID
Constructors Summary
public NetworkIdentitySet()


      
    
public NetworkIdentitySet(DataInputStream in)

        final int version = in.readInt();
        final int size = in.readInt();
        for (int i = 0; i < size; i++) {
            if (version <= VERSION_INIT) {
                final int ignored = in.readInt();
            }
            final int type = in.readInt();
            final int subType = in.readInt();
            final String subscriberId = readOptionalString(in);
            final String networkId;
            if (version >= VERSION_ADD_NETWORK_ID) {
                networkId = readOptionalString(in);
            } else {
                networkId = null;
            }
            final boolean roaming;
            if (version >= VERSION_ADD_ROAMING) {
                roaming = in.readBoolean();
            } else {
                roaming = false;
            }

            add(new NetworkIdentity(type, subType, subscriberId, networkId, false));
        }
    
Methods Summary
public intcompareTo(com.android.server.net.NetworkIdentitySet another)

        if (isEmpty()) return -1;
        if (another.isEmpty()) return 1;

        final NetworkIdentity ident = iterator().next();
        final NetworkIdentity anotherIdent = another.iterator().next();
        return ident.compareTo(anotherIdent);
    
private static java.lang.StringreadOptionalString(java.io.DataInputStream in)

        if (in.readByte() != 0) {
            return in.readUTF();
        } else {
            return null;
        }
    
private static voidwriteOptionalString(java.io.DataOutputStream out, java.lang.String value)

        if (value != null) {
            out.writeByte(1);
            out.writeUTF(value);
        } else {
            out.writeByte(0);
        }
    
public voidwriteToStream(java.io.DataOutputStream out)

        out.writeInt(VERSION_ADD_NETWORK_ID);
        out.writeInt(size());
        for (NetworkIdentity ident : this) {
            out.writeInt(ident.getType());
            out.writeInt(ident.getSubType());
            writeOptionalString(out, ident.getSubscriberId());
            writeOptionalString(out, ident.getNetworkId());
            out.writeBoolean(ident.getRoaming());
        }