Package gnu.java.lang

Examples of gnu.java.lang.CPStringBuilder


   */
  public static CertStore getInstance(String type, CertStoreParameters params,
                                      Provider provider)
      throws InvalidAlgorithmParameterException, NoSuchAlgorithmException
  {
    CPStringBuilder sb = new CPStringBuilder("CertStore of type [")
        .append(type).append("] from provider[")
        .append(provider).append("] could not be created");
    Throwable cause;
    try
      {
        Object[] args = new Object[] { params };
        Object spi = Engine.getInstance(CERT_STORE, type, provider, args);
        return new CertStore((CertStoreSpi) spi, provider, type, params);
      }
    catch (InvocationTargetException x)
      {
        cause = x.getCause();
        if (cause instanceof NoSuchAlgorithmException)
          throw (NoSuchAlgorithmException) cause;
        if (cause == null)
          cause = x;
      }
    catch (ClassCastException x)
      {
        cause = x;
      }
    NoSuchAlgorithmException x = new NoSuchAlgorithmException(sb.toString());
    x.initCause(cause);
    throw x;
  }
View Full Code Here


   *
   * @return this object as a <code>String</code>
   */
  public String toString()
  {
    CPStringBuilder string = new CPStringBuilder();
   
    string = string.append('(');
    string = string.append(getClass().getName());
    string = string.append(' ');
    string = string.append(getName());
   
    if (!(getActions().equals("")))
      {
        string = string.append(' ');
        string = string.append(getActions());
      }
  
    string = string.append(')');
    return string.toString();    
  }
View Full Code Here

   * @return the string
   */
  public String toString()
  {
    // FIXME: check if this is correct
    CPStringBuilder result;
    String separator = SystemProperties.getProperty("line.separator");

    result = new CPStringBuilder();
   
    result.append("name: ");
    result.append(getDisplayName());
    result.append(" (").append(getName()).append(") addresses:");
    result.append(separator);

    for (Iterator it = netif.addresses.iterator(); it.hasNext(); )
      {
  InetAddress address = (InetAddress) it.next();
  result.append(address.toString()).append(";").append(separator);
      }

    return result.toString();
  }
View Full Code Here

   *           <code>algorithm</code> is an empty string.
   */
  public static Signature getInstance(String algorithm, Provider provider)
    throws NoSuchAlgorithmException
  {
    CPStringBuilder sb = new CPStringBuilder("Signature algorithm [")
        .append(algorithm).append("] from provider[")
        .append(provider).append("] ");
    Object o;
    try
      {
        o = Engine.getInstance(SIGNATURE, algorithm, provider);
      }
    catch (InvocationTargetException x)
      {
        Throwable cause = x.getCause();
        if (cause instanceof NoSuchAlgorithmException)
          throw (NoSuchAlgorithmException) cause;
        if (cause == null)
          cause = x;
        sb.append("could not be created");
        NoSuchAlgorithmException y = new NoSuchAlgorithmException(sb.toString());
        y.initCause(cause);
        throw y;
      }
    Signature result;
    if (o instanceof SignatureSpi)
      result = new DummySignature((SignatureSpi) o, algorithm);
    else if (o instanceof Signature)
      {
        result = (Signature) o;
        result.algorithm = algorithm;
      }
    else
      {
        sb.append("is of an unexpected Type: ").append(o.getClass().getName());
        throw new NoSuchAlgorithmException(sb.toString());
      }
    result.provider = provider;
    return result;
  }
View Full Code Here

    return certPath;
  }

  public String toString()
  {
    CPStringBuilder buf = new CPStringBuilder(super.toString());
    buf.insert(buf.length() - 2, "; CertPath=" + certPath);
    return buf.toString();
  }
View Full Code Here

   */
  public static KeyPairGenerator getInstance(String algorithm,
               Provider provider)
    throws NoSuchAlgorithmException
  {
    CPStringBuilder sb = new CPStringBuilder("KeyPairGenerator for algorithm [")
        .append(algorithm).append("] from provider[")
        .append(provider).append("] ");
    Object o;
    try
      {
        o = Engine.getInstance(KEY_PAIR_GENERATOR, algorithm, provider);
      }
    catch (InvocationTargetException x)
      {
        Throwable cause = x.getCause();
        if (cause instanceof NoSuchAlgorithmException)
          throw (NoSuchAlgorithmException) cause;
        if (cause == null)
          cause = x;
        sb.append("could not be created");
        NoSuchAlgorithmException y = new NoSuchAlgorithmException(sb.toString());
        y.initCause(cause);
        throw y;
      }
    KeyPairGenerator result;
    if (o instanceof KeyPairGenerator)
      {
        result = (KeyPairGenerator) o;
        result.algorithm = algorithm;
      }
    else if (o instanceof KeyPairGeneratorSpi)
      result = new DummyKeyPairGenerator((KeyPairGeneratorSpi) o, algorithm);
    else
      {
        sb.append("is of an unexpected Type: ").append(o.getClass().getName());
        throw new NoSuchAlgorithmException(sb.toString());
      }
    result.provider = provider;
    return result;
  }
View Full Code Here

    result = Long.toString(value);
      }
    else
      throw new IllegalFormatConversionException(conversion, arg.getClass());

    return new CPStringBuilder(result);
  }
View Full Code Here

            char conversion)
    throws IOException
  {
    assert radix == 8 || radix == 16;

    CPStringBuilder builder = basicIntegralConversion(arg, flags, width,
                  precision, radix,
                  conversion);
    int insertPoint = 0;

    // Insert the sign.
    if (builder.charAt(0) == '-')
      {
  // Already inserted.  Note that we don't insert a sign, since
  // the only case where it is needed it BigInteger, and it has
  // already been inserted by toString.
  ++insertPoint;
      }
    else if ((flags & FormattableFlags.PLUS) != 0)
      {
  builder.insert(insertPoint, '+');
  ++insertPoint;
      }
    else if ((flags & FormattableFlags.SPACE) != 0)
      {
  builder.insert(insertPoint, ' ');
  ++insertPoint;
      }

    // Insert the radix prefix.
    if ((flags & FormattableFlags.ALTERNATE) != 0)
      {
  builder.insert(insertPoint, radix == 8 ? "0" : "0x");
  insertPoint += radix == 8 ? 1 : 2;
      }

    // Now justify the result.
    int resultWidth = builder.length();
    if (resultWidth < width)
      {
  char fill = ((flags & FormattableFlags.ZERO) != 0) ? '0' : ' ';
  if ((flags & FormattableFlags.LEFT_JUSTIFY) != 0)
    {
      // Left justify. 
      if (fill == ' ')
        insertPoint = builder.length();
    }
  else
    {
      // Right justify.  Insert spaces before the radix prefix
      // and sign.
      insertPoint = 0;
    }
  while (resultWidth++ < width)
    builder.insert(insertPoint, fill);
      }

    String result = builder.toString();
    if ((flags & FormattableFlags.UPPERCASE) != 0)
      {
  if (fmtLocale == null)
    result = result.toUpperCase();
  else
View Full Code Here

   */
  private void decimalConversion(Object arg, int flags, int width,
         int precision, char conversion)
    throws IOException
  {
    CPStringBuilder builder = basicIntegralConversion(arg, flags, width,
                  precision, 10,
                  conversion);
    boolean isNegative = false;
    if (builder.charAt(0) == '-')
      {
  // Sign handling is done during localization.
  builder.deleteCharAt(0);
  isNegative = true;
      }

    applyLocalization(builder, flags, width, isNegative);
    genericFormat(builder.toString(), flags, width, precision);
  }
View Full Code Here

  public String toString()
  {
    List l = getCertificates();
    int size = l.size();
    int i = 0;
    CPStringBuilder result = new CPStringBuilder(type);
    result.append(" Cert Path: length = ").append(size).append(".\n[\n");
    while (--size >= 0)
      result.append(l.get(i++)).append('\n');
    return result.append("\n]").toString();
  }
View Full Code Here

TOP

Related Classes of gnu.java.lang.CPStringBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.