1 package org.bouncycastle.util.io.pem; 2 3 public class PemHeader 4 { 5 private String name; 6 private String value; 7 PemHeader(String name, String value)8 public PemHeader(String name, String value) 9 { 10 this.name = name; 11 this.value = value; 12 } 13 getName()14 public String getName() 15 { 16 return name; 17 } 18 getValue()19 public String getValue() 20 { 21 return value; 22 } 23 hashCode()24 public int hashCode() 25 { 26 return getHashCode(this.name) + 31 * getHashCode(this.value); 27 } 28 equals(Object o)29 public boolean equals(Object o) 30 { 31 if (!(o instanceof PemHeader)) 32 { 33 return false; 34 } 35 36 PemHeader other = (PemHeader)o; 37 38 return other == this || (isEqual(this.name, other.name) && isEqual(this.value, other.value)); 39 } 40 getHashCode(String s)41 private int getHashCode(String s) 42 { 43 if (s == null) 44 { 45 return 1; 46 } 47 48 return s.hashCode(); 49 } 50 isEqual(String s1, String s2)51 private boolean isEqual(String s1, String s2) 52 { 53 if (s1 == s2) 54 { 55 return true; 56 } 57 58 if (s1 == null || s2 == null) 59 { 60 return false; 61 } 62 63 return s1.equals(s2); 64 } 65 66 } 67