1 36 package org.columba.ristretto.message; 37 38 44 public class MimeType { 45 46 private String type; 47 private String subtype; 48 49 55 public MimeType( String type, String subtype) { 56 this.type = type; 57 this.subtype = subtype; 58 } 59 60 63 public MimeType() { 64 this( "text", "plain"); 65 } 66 67 70 public String getSubtype() { 71 return subtype; 72 } 73 74 77 public String getType() { 78 return type; 79 } 80 81 84 public void setSubtype(String string) { 85 subtype = string; 86 } 87 88 91 public void setType(String string) { 92 type = string; 93 } 94 95 98 public boolean equals(Object arg0) { 99 boolean result = true; 100 MimeType arg = (MimeType) arg0; 101 if( type != null) { 102 result &= this.type.equals(arg.type); 103 } 104 if( subtype != null) { 105 result &= this.subtype.equals((arg.subtype)); 106 } 107 return result; 108 } 109 110 113 public String toString() { 114 return type + '/' + subtype; 115 } 116 117 120 public int hashCode() { 121 return this.toString().hashCode(); 122 } 123 124 } 125 | Popular Tags |