// Encode this extension
 private void encodeThis() throws IOException {
   DerOutputStream os = new DerOutputStream();
   try {
     names.encode(os);
   } catch (GeneralNamesException e) {
     throw new IOException("SubjectAlternativeName: " + e);
   }
   extensionValue = os.toByteArray();
 }
 /**
  * Write the extension to the OutputStream.
  *
  * @param out the OutputStream to write the extension to.
  * @exception IOException on encoding errors.
  */
 public void encode(OutputStream out) throws IOException {
   DerOutputStream tmp = new DerOutputStream();
   if (extensionValue == null) {
     extensionId = PKIXExtensions.SubjectAlternativeName_Id;
     // critical = false;
     encodeThis();
   }
   super.encode(tmp);
   out.write(tmp.toByteArray());
 }