Home | History | Annotate | Download | only in supl_init
      1 /*
      2  * Copyright (C) 2017 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 package android.location.cts.asn1.supl2.supl_init;
     18 
     19 /*
     20  */
     21 
     22 
     23 //
     24 //
     25 import android.location.cts.asn1.base.Asn1BitString;
     26 import android.location.cts.asn1.base.Asn1Tag;
     27 import android.location.cts.asn1.base.BitStream;
     28 import android.location.cts.asn1.base.BitStreamReader;
     29 import com.google.common.collect.ImmutableList;
     30 import java.util.Collection;
     31 import javax.annotation.Nullable;
     32 
     33 
     34 /**
     35  */
     36 public  class KeyIdentity extends Asn1BitString {
     37   //
     38 
     39   private static final Asn1Tag TAG_KeyIdentity
     40       = Asn1Tag.fromClassAndNumber(-1, -1);
     41 
     42   public KeyIdentity() {
     43     super();
     44     setMinSize(128);
     45 setMaxSize(128);
     46 
     47   }
     48 
     49   @Override
     50   @Nullable
     51   protected Asn1Tag getTag() {
     52     return TAG_KeyIdentity;
     53   }
     54 
     55   @Override
     56   protected boolean isTagImplicit() {
     57     return true;
     58   }
     59 
     60   public static Collection<Asn1Tag> getPossibleFirstTags() {
     61     if (TAG_KeyIdentity != null) {
     62       return ImmutableList.of(TAG_KeyIdentity);
     63     } else {
     64       return Asn1BitString.getPossibleFirstTags();
     65     }
     66   }
     67 
     68   /**
     69    * Creates a new KeyIdentity from encoded stream.
     70    */
     71   public static KeyIdentity fromPerUnaligned(byte[] encodedBytes) {
     72     KeyIdentity result = new KeyIdentity();
     73     result.decodePerUnaligned(new BitStreamReader(encodedBytes));
     74     return result;
     75   }
     76 
     77   /**
     78    * Creates a new KeyIdentity from encoded stream.
     79    */
     80   public static KeyIdentity fromPerAligned(byte[] encodedBytes) {
     81     KeyIdentity result = new KeyIdentity();
     82     result.decodePerAligned(new BitStreamReader(encodedBytes));
     83     return result;
     84   }
     85 
     86   @Override public Iterable<BitStream> encodePerUnaligned() {
     87     return super.encodePerUnaligned();
     88   }
     89 
     90   @Override public Iterable<BitStream> encodePerAligned() {
     91     return super.encodePerAligned();
     92   }
     93 
     94   @Override public void decodePerUnaligned(BitStreamReader reader) {
     95     super.decodePerUnaligned(reader);
     96   }
     97 
     98   @Override public void decodePerAligned(BitStreamReader reader) {
     99     super.decodePerAligned(reader);
    100   }
    101 
    102   @Override public String toString() {
    103     return toIndentedString("");
    104   }
    105 
    106   public String toIndentedString(String indent) {
    107     return "KeyIdentity = " + getValue() + ";\n";
    108   }
    109 }
    110