Encodes the name in DER-encoded form.

@param out where to put the DER-encoded X.500 name
196491
public void encode(DerOutputStream out) throws IOException {
        DerOutputStream tmp = new DerOutputStream();
        for (int i = 0; i < names.length; i++) {
            names[i].encode(tmp);
        }
        out.write(DerValue.tag_Sequence, tmp);
    }
261316
public void encode(DerOutputStream out) throws IOException {
        DerOutputStream tagged = new DerOutputStream();
        DerOutputStream tmp = new DerOutputStream();

        if (assigner != null) {
            DerOutputStream tmp2 = new DerOutputStream();
            // XXX - shd check is chars fit into PrintableString
            tmp2.putPrintableString(assigner);
            tagged.write(DerValue.createTag(DerValue.TAG_CONTEXT,
                                 false, TAG_ASSIGNER), tmp2);
        }
        if (party == null)
            throw  new IOException("Cannot have null partyName");

        // XXX - shd check is chars fit into PrintableString
        tmp.putPrintableString(party);
        tagged.write(DerValue.createTag(DerValue.TAG_CONTEXT,
                                 false, TAG_PARTYNAME), tmp);

        out.write(DerValue.tag_Sequence, tagged);
    }
522591
private void encodeThis() throws IOException {
        if (id == null) {
            this.extensionValue = null;
            return;
        }
        DerOutputStream os = new DerOutputStream();
        id.encode(os);
        this.extensionValue = os.toByteArray();
    }
659718
def encode(self, name, as_map_key=False):
        """"""
        if name in self.key_to_value:
            return self.key_to_value[name]
        return self.encache(name) if is_cacheable(name, as_map_key) else name
1300535
public void encode(DerOutputStream out) throws IOException {

        DerOutputStream tmp = new DerOutputStream();
        hashAlgId.encode(tmp);
        tmp.putOctetString(issuerNameHash);
        tmp.putOctetString(issuerKeyHash);
        certSerialNumber.encode(tmp);
        out.write(DerValue.tag_Sequence, tmp);

        if (debug) {
            HexDumpEncoder encoder = new HexDumpEncoder();
            System.out.println("Encoded certId is " +
                encoder.encode(out.toByteArray()));
        }
    }
2247
@Override
    public void encode(OutputStream output, Indenter indenter) {
        encode(output, indenter, null);
    }
1161133
private static String encode(String s) {
    int n = INITIAL_N;
    int delta = 0;
    int bias = INITIAL_BIAS;
    StringBuffer output = new StringBuffer();

    // Copy all basic code points to the output.
    int b = 0;
    for (int i = 0; i < s.length(); i++) {
      char c = s.charAt(i);
      if (basicCodePoint(c)) {
        output.append(c);
        b++;
      }
    }
    if (b > 0) {
      output.append(DELIMITER);
    }
    int h = b;
    while (h < s.length()) {
      int m = Integer.MAX_VALUE;
      for (int i = 0; i < s.length(); i++) {
        int c = s.charAt(i);
        if (c >= n && c < m) {
          m = c;
        }
      }
      if (m - n > (Integer.MAX_VALUE - delta) / (h + 1)) {
        // This should probably be a java.text.ParseException, but
        // IllegalArgumentException is what Android's IDN expects.
        throw new IllegalArgumentException("encoding overflow");
      }
      delta = delta + (m - n) * (h + 1);
      n = m;
      for (int j = 0; j < s.length(); j++) {
        int c = s.charAt(j);
        if (c < n) {
          delta++;
          if (0 == delta) {
            throw new IllegalArgumentException("encoding overflow");
          }
        }
        if (c == n) {
          int q = delta;
          for (int k = BASE;; k += BASE) {
            int t;
            if (k <= bias) {
              t = TMIN;
            } else if (k >= bias + TMAX) {
              t = TMAX;
            } else {
              t = k - bias;
            }
            if (q < t) {
              break;
            }
            output.append((char) encodeDigit(t + (q - t) % (BASE - t)));
            q = (q - t) / (BASE - t);
          }

          output.append((char) encodeDigit(q));
          bias = adapt(delta, h + 1, h == b);
          delta = 0;
          h++;
        }
      }
      delta++;
      n++;
    }
    return output.toString();
  }
192122
public void encode(OutputStream out) throws IOException {
        DerOutputStream tmp = new DerOutputStream();
        if (extensionValue == null) {
            extensionId = PKIXExtensions.SubjectKey_Id;
            critical = false;
            encodeThis();
        }
        super.encode(tmp);
        out.write(tmp.toByteArray());
    }
661832
private void encodeThis() throws IOException {
        if (notBefore == null && notAfter == null) {
            this.extensionValue = null;
            return;
        }
        DerOutputStream seq = new DerOutputStream();

        DerOutputStream tagged = new DerOutputStream();
        if (notBefore != null) {
            DerOutputStream tmp = new DerOutputStream();
            tmp.putGeneralizedTime(notBefore);
            tagged.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT,
                                 false, TAG_BEFORE), tmp);
        }
        if (notAfter != null) {
            DerOutputStream tmp = new DerOutputStream();
            tmp.putGeneralizedTime(notAfter);
            tagged.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT,
                                 false, TAG_AFTER), tmp);
        }
        seq.write(DerValue.tag_Sequence, tagged);
        this.extensionValue = seq.toByteArray();
    }
180036
public void encode(DerOutputStream out) throws IOException {
        DerOutputStream seq = new DerOutputStream();

        name.encode(seq);

        if (minimum != MIN_DEFAULT) {
            DerOutputStream tmp = new DerOutputStream();
            tmp.putInteger(minimum);
            seq.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT,
                              false, TAG_MIN), tmp);
        }
        if (maximum != -1) {
            DerOutputStream tmp = new DerOutputStream();
            tmp.putInteger(maximum);
            seq.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT,
                              false, TAG_MAX), tmp);
        }
        out.write(DerValue.tag_Sequence, seq);
    }
1208779
public void writeExternal(ObjectOutput out) throws IOException
   {
      byte[] buf = id.getBytes(Constants.DEFAULT_ENCODING);
      out.writeInt(buf.length);
      out.write(buf);
      
      if (parentId == null)
      {
         out.writeInt(-1);
      }
      else
      {
         buf = parentId.getBytes(Constants.DEFAULT_ENCODING);
         out.writeInt(buf.length);
         out.write(buf);
      }
      if (name == null)
      {
         out.writeInt(-1);
      }
      else
      {
         buf = name.getAsString(true).getBytes(Constants.DEFAULT_ENCODING);
         out.writeInt(buf.length);
         out.write(buf);
      }
      if (path == null)
      {
         out.writeInt(-1);
      }
      else
      {
         buf = path.getAsString().getBytes(Constants.DEFAULT_ENCODING);
         out.writeInt(buf.length);
         out.write(buf);
      }
   }
238186
public void encode(DerOutputStream out) throws IOException {

        if (extensionId == null)
            throw new IOException("Null OID to encode for the extension!");
        if (extensionValue == null)
            throw new IOException("No value to encode for the extension!");

        DerOutputStream dos = new DerOutputStream();

        dos.putOID(extensionId);
        if (critical)
            dos.putBoolean(critical);
        dos.putOctetString(extensionValue);

        out.write(DerValue.tag_Sequence, dos);
    }
133495
public static String encode(String name)
   {
      // quick check for root node name
      if (name.length() == 0)
      {
         return name;
      }
      if (XMLChar.isValidName(name) && name.indexOf("_x") < 0)
      {
         // already valid
         return name;
      }
      else
      {
         // encode
         StringBuilder encoded = new StringBuilder();
         for (int i = 0; i < name.length(); i++)
         {
            if (i == 0)
            {
               // first character of name
               if (XMLChar.isNameStart(name.charAt(i)))
               {
                  if (needsEscaping(name, i))
                  {
                     // '_x' must be encoded
                     encode('_', encoded);
                  }
                  else
                  {
                     encoded.append(name.charAt(i));
                  }
               }
               else
               {
                  // not valid as first character -> encode
                  encode(name.charAt(i), encoded);
               }
            }
            else if (!XMLChar.isName(name.charAt(i)))
            {
               encode(name.charAt(i), encoded);
            }
            else
            {
               if (needsEscaping(name, i))
               {
                  // '_x' must be encoded
                  encode('_', encoded);
               }
               else
               {
                  encoded.append(name.charAt(i));
               }
            }
         }
         return encoded.toString();
      }
   }
1159241
public static String outputStream2String(final OutputStream out, final String charsetName) {
        if (out == null || isSpace(charsetName)) return null;
        try {
            return new String(outputStream2Bytes(out), charsetName);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
            return null;
        }
    }
935745
@Deprecated
    public static String encode(String name, String value) {
        return io.netty.handler.codec.http.cookie.ClientCookieEncoder.LAX.encode(name, value);
    }
383089
public void encode(OutputStream out)
    throws CertificateEncodingException {
        if (signedCert == null)
            throw new CertificateEncodingException(
                          "Null certificate to encode");
        try {
            out.write(signedCert.clone());
        } catch (IOException e) {
            throw new CertificateEncodingException(e.toString());
        }
    }
30411
function encodeAddressName(name) {
  if (!/^[\w ']*$/.test(name)) {
    if (/^[\x20-\x7e]*$/.test(name)) {
      return JSON.stringify(name);
    } else {
      return (0, _emailjsMimeCodec.mimeWordEncode)(name, 'Q', 52);
    }
  }
  return name;
}