Package com.caucho.util

Examples of com.caucho.util.Sha256OutputStream


    TempOutputStream os = null;

    try {
      os = new TempOutputStream();

      Sha256OutputStream mOut = new Sha256OutputStream(os);
      DeflaterOutputStream gzOut = new DeflaterOutputStream(mOut);

      serializer.serialize(value, gzOut);

      gzOut.finish();
      mOut.close();

      byte[] hash = mOut.getDigest();

      HashKey valueHash = new HashKey(hash);

      if (valueHash.equals(oldValueHash))
        return valueHash;
View Full Code Here


    TempOutputStream os = null;
   
    try {
      os = new TempOutputStream();

      Sha256OutputStream mOut = new Sha256OutputStream(os);
      DeflaterOutputStream gzOut = new DeflaterOutputStream(mOut);

      serializer.serialize(value, gzOut);

      gzOut.finish();
      mOut.close();

      byte[] hash = mOut.getDigest();

      return hash;
    } catch (Exception e) {
      throw new RuntimeException(e);
    } finally {
View Full Code Here

    TempOutputStream os = null;

    try {
      os = new TempOutputStream();

      Sha256OutputStream mOut = new Sha256OutputStream(os);

      WriteStream out = Vfs.openWrite(mOut);

      out.writeStream(is);

      out.close();

      mOut.close();

      byte[] hash = mOut.getDigest();

      HashKey valueHash = new HashKey(hash);

      if (valueHash.equals(oldValueHash)) {
        os.destroy();
View Full Code Here

    TempOutputStream os = null;

    try {
      os = new TempOutputStream();

      Sha256OutputStream mOut = new Sha256OutputStream(os);
      DeflaterOutputStream gzOut = new DeflaterOutputStream(mOut);

      serializer.serialize(value, gzOut);

      gzOut.finish();
      mOut.close();

      byte[] hash = mOut.getDigest();

      HashKey valueHash = new HashKey(hash);

      if (valueHash.equals(oldValueHash))
        return valueHash;
View Full Code Here

    TempOutputStream os = null;

    try {
      os = new TempOutputStream();

      Sha256OutputStream mOut = new Sha256OutputStream(os);

      WriteStream out = Vfs.openWrite(mOut);

      out.writeStream(is);

      out.close();

      mOut.close();

      byte[] hash = mOut.getDigest();

      HashKey valueHash = new HashKey(hash);

      if (valueHash.equals(oldValueHash)) {
        os.destroy();
View Full Code Here

  }

  protected String calculatePassivationId()
  {
    try {
      Sha256OutputStream os = new Sha256OutputStream(new NullOutputStream());
      WriteStream out = Vfs.openWrite(os);

      out.print(getJavaClass());

      ArrayList<String> typeList = new ArrayList<String>();

      for (Type type : getTypes()) {
        typeList.add(type.toString());
      }
      Collections.sort(typeList);

      for (String typeString : typeList) {
        out.print(";");
        out.print(typeString);
      }

      if (getName() != null) {
        out.print(";name=");
        out.print(getName());
      }

      ArrayList<String> annList = new ArrayList<String>();

      for (Annotation ann : getQualifiers()) {
        annList.add(bindingToString(ann));
      }

      Collections.sort(annList);

      for (String annString : annList) {
        out.print(";");
        out.print(annString);
      }
     
      // ioc/0l34
      if (getAnnotatedType() != null) {
        XmlCookie xmlCookie = getAnnotatedType().getAnnotation(XmlCookie.class);
        if (xmlCookie != null) {
          out.print(";xmlcookie=" + xmlCookie.value());
        }
      }

      out.close();

      return Base64.encodeFromByteArray(os.getDigest());
    } catch (IOException e) {
      throw new IllegalStateException(e);
    }
  }
View Full Code Here

TOP

Related Classes of com.caucho.util.Sha256OutputStream

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.