org.jclouds.util.Utils



API Populatity

2 Client projects

Project: org.jclouds

Package: org.jclouds.util

Project jclouds/jclouds in file ...ds.gogrid.filters.SharedKeyLiteAuthentication.java (2010-07-06)
@@ -42,6 +42,7 @@ import org.jclouds.encryption.EncryptionService;
 import org.jclouds.http.HttpRequest;
 import org.jclouds.http.HttpRequestFilter;
 import org.jclouds.logging.Logger;
+import org.jclouds.util.Utils;
 
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Multimap;
@@ -95,7 +96,7 @@ public class SharedKeyLiteAuthentication implements HttpRequestFilter {
 
    private String getMd5For(String stringToHash) {
       try {
-         return encryptionService.md5Hex(stringToHash.getBytes());
+         return encryptionService.hex(encryptionService.md5(Utils.toInputStream(stringToHash)));
       } catch (Exception e) {
          throw new RuntimeException(e);
       }
Project jclouds/jclouds in file ...s.s3.functions.ParseObjectMetadataFromHeaders.java (2010-01-18)
@@ -30,6 +30,7 @@ import org.jclouds.encryption.EncryptionService;
 import org.jclouds.http.HttpResponse;
 import org.jclouds.rest.InvocationContext;
 import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.util.Utils;
 
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Function;
@@ -63,7 +64,7 @@ public class ParseObjectMetadataFromHeaders implements
       BlobMetadata base = blobMetadataParser.apply(from);
       MutableObjectMetadata to = blobToObjectMetadata.apply(base);
       addETagTo(from, to);
-      to.setContentMD5(encryptionService.fromHexString(to.getETag().replaceAll("\"", "")));
+      to.setContentMD5(encryptionService.fromHexString(Utils.replaceAll(to.getETag(), '"', "")));
       to.setCacheControl(from.getFirstHeaderOrNull(HttpHeaders.CACHE_CONTROL));
       to.setContentDisposition(from.getFirstHeaderOrNull("Content-Disposition"));
       to.setContentEncoding(from.getFirstHeaderOrNull(HttpHeaders.CONTENT_ENCODING));
Project jclouds/jclouds in file ...java.org.jclouds.aws.s3.xml.ListBucketHandler.java (2010-01-18)
@@ -32,6 +32,7 @@ import org.jclouds.aws.s3.domain.internal.TreeSetListBucketResponse;
 import org.jclouds.date.DateService;
 import org.jclouds.encryption.EncryptionService;
 import org.jclouds.http.functions.ParseSax;
+import org.jclouds.util.Utils;
 import org.xml.sax.Attributes;
 
 import com.google.common.collect.Sets;
@@ -100,7 +101,7 @@ public class ListBucketHandler extends ParseSax.HandlerWithResult<ListBucketResp
          currentLastModified = dateParser.iso8601DateParse(currentText.toString().trim());
       } else if (qName.equals("ETag")) {
          currentETag = currentText.toString().trim();
-         currentMD5 = encryptionService.fromHexString(currentETag.replaceAll("\"", ""));
+         currentMD5 = encryptionService.fromHexString(Utils.replaceAll(currentETag,'"', ""));
       } else if (qName.equals("Size")) {
          currentSize = new Long(currentText.toString().trim());
       } else if (qName.equals("Owner")) {