204 * paths, {@code path1} and {@code path2}, as required by the
205 * general contract of {@code Object.hashCode}.
206 *
207 * @return the hashcode value for this certification path
208 */
209 public int hashCode() {
210 int hashCode = type.hashCode();
211 hashCode = 31*hashCode + getCertificates().hashCode();
212 return hashCode;
213 }
214
215 /**
216 * Returns a string representation of this certification path.
217 * This calls the {@code toString} method on each of the
218 * {@code Certificate}s in the path.
219 *
220 * @return a string representation of this certification path
221 */
222 public String toString() {
223 StringBuilder sb = new StringBuilder();
224 Iterator<? extends Certificate> stringIterator =
225 getCertificates().iterator();
226
227 sb.append("\n" + type + " Cert Path: length = "
228 + getCertificates().size() + ".\n");
229 sb.append("[\n");
230 int i = 1;
231 while (stringIterator.hasNext()) {
232 sb.append("=========================================="
233 + "===============Certificate " + i + " start.\n");
234 Certificate stringCert = stringIterator.next();
235 sb.append(stringCert.toString());
236 sb.append("\n========================================"
237 + "=================Certificate " + i + " end.\n\n\n");
238 i++;
239 }
240
241 sb.append("\n]");
242 return sb.toString();
243 }
244
245 /**
246 * Returns the encoded form of this certification path, using the default
247 * encoding.
248 *
249 * @return the encoded bytes
250 * @exception CertificateEncodingException if an encoding error occurs
251 */
252 public abstract byte[] getEncoded()
253 throws CertificateEncodingException;
254
255 /**
256 * Returns the encoded form of this certification path, using the
257 * specified encoding.
|
204 * paths, {@code path1} and {@code path2}, as required by the
205 * general contract of {@code Object.hashCode}.
206 *
207 * @return the hashcode value for this certification path
208 */
209 public int hashCode() {
210 int hashCode = type.hashCode();
211 hashCode = 31*hashCode + getCertificates().hashCode();
212 return hashCode;
213 }
214
215 /**
216 * Returns a string representation of this certification path.
217 * This calls the {@code toString} method on each of the
218 * {@code Certificate}s in the path.
219 *
220 * @return a string representation of this certification path
221 */
222 public String toString() {
223 StringBuilder sb = new StringBuilder();
224
225 sb.append('\n').append(type).append(" Cert Path: length = ")
226 .append(getCertificates().size()).append(".\n").append("[\n");
227 int i = 1;
228 for (Certificate stringCert : getCertificates()) {
229 sb.append("=========================================="
230 + "===============Certificate ").append(i).append(" start.\n");
231 sb.append(stringCert.toString());
232 sb.append("\n========================================"
233 + "=================Certificate ").append(i).append(" end.\n\n\n");
234 i++;
235 }
236
237 sb.append("\n]");
238 return sb.toString();
239 }
240
241 /**
242 * Returns the encoded form of this certification path, using the default
243 * encoding.
244 *
245 * @return the encoded bytes
246 * @exception CertificateEncodingException if an encoding error occurs
247 */
248 public abstract byte[] getEncoded()
249 throws CertificateEncodingException;
250
251 /**
252 * Returns the encoded form of this certification path, using the
253 * specified encoding.
|