148 * @return The hash code of this address as an int.
149 */
150 public int hashCode() {
151 int hash = addrType.hashCode();
152 for (int i = 0; i < buf.length; i++) {
153 hash += buf[i]; // %%% improve later
154 }
155 return hash;
156 }
157
158 /**
159 * Generates the string representation of this address.
160 * The string consists of the address's type and contents with labels.
161 * The first 32 bytes of contents are displayed (in hexadecimal).
162 * If there are more than 32 bytes, "..." is used to indicate more.
163 * This string is meant to used for debugging purposes and not
164 * meant to be interpreted programmatically.
165 * @return The non-null string representation of this address.
166 */
167 public String toString(){
168 StringBuilder str = new StringBuilder("Address Type: " + addrType + "\n");
169
170 str.append("AddressContents: ");
171 for (int i = 0; i<buf.length && i < 32; i++) {
172 str.append(Integer.toHexString(buf[i]) +" ");
173 }
174 if (buf.length >= 32)
175 str.append(" ...\n");
176 return (str.toString());
177 }
178
179 /**
180 * Use serialVersionUID from JNDI 1.1.1 for interoperability
181 */
182 private static final long serialVersionUID = -3415254970957330361L;
183 }
|
148 * @return The hash code of this address as an int.
149 */
150 public int hashCode() {
151 int hash = addrType.hashCode();
152 for (int i = 0; i < buf.length; i++) {
153 hash += buf[i]; // %%% improve later
154 }
155 return hash;
156 }
157
158 /**
159 * Generates the string representation of this address.
160 * The string consists of the address's type and contents with labels.
161 * The first 32 bytes of contents are displayed (in hexadecimal).
162 * If there are more than 32 bytes, "..." is used to indicate more.
163 * This string is meant to used for debugging purposes and not
164 * meant to be interpreted programmatically.
165 * @return The non-null string representation of this address.
166 */
167 public String toString(){
168 StringBuilder str = new StringBuilder();
169 str.append("Address Type: ").append(addrType).append('\n');
170 str.append("AddressContents: ");
171 for (int i = 0; i<buf.length && i < 32; i++) {
172 str.append(Integer.toHexString(buf[i])).append(' ');
173 }
174 if (buf.length >= 32)
175 str.append(" ...\n");
176 return (str.toString());
177 }
178
179 /**
180 * Use serialVersionUID from JNDI 1.1.1 for interoperability
181 */
182 private static final long serialVersionUID = -3415254970957330361L;
183 }
|