Package java.math

Examples of java.math.BigInteger$UnsafeHolder


    signature=java.security.Signature.getInstance("SHA1withRSA");
    keyFactory=KeyFactory.getInstance("RSA");
  }    
  public void setPubKey(byte[] e, byte[] n) throws Exception{
    RSAPublicKeySpec rsaPubKeySpec =
  new RSAPublicKeySpec(new BigInteger(n),
           new BigInteger(e));
    PublicKey pubKey=keyFactory.generatePublic(rsaPubKeySpec);
    signature.initVerify(pubKey);
  }
View Full Code Here


    PublicKey pubKey=keyFactory.generatePublic(rsaPubKeySpec);
    signature.initVerify(pubKey);
  }
  public void setPrvKey(byte[] d, byte[] n) throws Exception{
    RSAPrivateKeySpec rsaPrivKeySpec =
  new RSAPrivateKeySpec(new BigInteger(n),
            new BigInteger(d));
    PrivateKey prvKey = keyFactory.generatePrivate(rsaPrivKeySpec);
    signature.initSign(prvKey);
  }
View Full Code Here

      SimpleMetaType st = (SimpleMetaType)type;
     
      if (SimpleMetaType.BIGDECIMAL.equals(st)) {
        return new SimpleValueSupport(st, new BigDecimal(value));
      } else if (SimpleMetaType.BIGINTEGER.equals(st)) {
        return new SimpleValueSupport(st, new BigInteger(value));
      } else if (SimpleMetaType.BOOLEAN.equals(st)) {
        return new SimpleValueSupport(st, Boolean.valueOf(value));
      } else if (SimpleMetaType.BOOLEAN_PRIMITIVE.equals(st)) {
        return new SimpleValueSupport(st, Boolean.valueOf(value).booleanValue());
      } else if (SimpleMetaType.BYTE.equals(st)) {
View Full Code Here

        }
    }
   
    private static class BigIntegerColumnSerializer extends ColumnSerializer {
        protected void writeObject(ObjectOutput out, Object obj) throws IOException {
            BigInteger val = (BigInteger)obj;
            byte[] bytes = val.toByteArray();
            out.writeInt(bytes.length);
            out.write(bytes);
        }
View Full Code Here

        }
        protected Object readObject(ObjectInput in) throws IOException {
            int length = in.readInt();
            byte[] bytes = new byte[length];
            in.readFully(bytes);
            return new BigInteger(bytes);
        }
View Full Code Here

   
    private static class BigDecimalColumnSerializer extends ColumnSerializer {
        protected void writeObject(ObjectOutput out, Object obj) throws IOException {
            BigDecimal val = (BigDecimal)obj;
            out.writeInt(val.scale());
            BigInteger unscaled = val.unscaledValue();
            byte[] bytes = unscaled.toByteArray();
            out.writeInt(bytes.length);
            out.write(bytes);
        }
View Full Code Here

        protected Object readObject(ObjectInput in) throws IOException {
            int scale = in.readInt();
            int length = in.readInt();
            byte[] bytes = new byte[length];
            in.readFully(bytes);
            return new BigDecimal(new BigInteger(bytes), scale);
        }
View Full Code Here

   * @throws TransformationException if value is an incorrect input type or
   * the transformation fails
   */
  public Object transformDirect(Object value) throws TransformationException {
    try {
      return new BigInteger(((String)value).trim());
    } catch(NumberFormatException e) {
      throw new TransformationException("ERR.003.029.0015", CorePlugin.Util.getString("ERR.003.029.0015", value)); //$NON-NLS-1$ //$NON-NLS-2$
    }
  }
View Full Code Here

    }

    // Source = BIGINTEGER
   
    public void testBigIntegerToString() throws Exception {
        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "string", "char(1)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    }
View Full Code Here

    public void testBigIntegerToString() throws Exception {
        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "string", "char(1)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    }

    public void testBigIntegerToBoolean() throws Exception {
        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "boolean", "CASE WHEN 1 = 0 THEN 0 WHEN 1 IS NOT NULL THEN 1 END"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    }
View Full Code Here

TOP

Related Classes of java.math.BigInteger$UnsafeHolder

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.