Package com.thoughtworks.xstream.core.util

Examples of com.thoughtworks.xstream.core.util.Base64Encoder


  public String toString(Object obj) {
    try {
      File file = ((Blob) obj).getFile();
      if (file.exists()) {
        return new Base64Encoder().encode(FileUtils
            .readFileToByteArray(file));
      } else {
        return "";
      }
    } catch (Exception e) {
View Full Code Here


  public Object fromString(String str) {
    Blob blob = new Blob();
    try {
      FileUtils.writeByteArrayToFile(blob.getFile(),
          new Base64Encoder().decode(str));
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
    return blob;
  }
View Full Code Here

        String home = getHudsonHome();
        if(!home.endsWith("/"))     home = home + '/'// make sure it ends with '/'

        // check for authentication info
        String auth = new URL(home).getUserInfo();
        if(auth != null) auth = "Basic " + new Base64Encoder().encode(auth.getBytes("UTF-8"));

        {// check if the home is set correctly
            HttpURLConnection con = open(new URL(home));
            if (auth != null) con.setRequestProperty("Authorization", auth);
            con.connect();
View Full Code Here

    /**
     * Create ObjectId converter
     */
    public ObjectIdConverter() {
        base64 = new Base64Encoder();
    }
View Full Code Here

              arquivo = pathRaiz + arquivo;
          }
         
          md.update(arquivo.getBytes());
         
          Base64Encoder bEncoder = new Base64Encoder();
         
        
         
          hashCodeStr = URLEncoder.encode(bEncoder.encode(md.digest()), Dominios.ENCODING_DEFAULT);
         
            //   %2B
          return hashCodeStr;
         
      }
View Full Code Here

              arquivo = pathRaiz + arquivo;
          }
         
          md.update(arquivo.getBytes());
         
          Base64Encoder bEncoder = new Base64Encoder();
         
         
         
          if (encode){
            hashCodeStr = URLEncoder.encode(bEncoder.encode(md.digest()), Dominios.ENCODING_DEFAULT);
          }
          else{
            hashCodeStr = bEncoder.encode(md.digest());
          }
         
            //   %2B
          return hashCodeStr;
         
View Full Code Here

    public Element getContentVersionValueElement(ContentVersionVO vo) throws SystemException, Bug, UnsupportedEncodingException
    {
        Element value = DocumentHelper.createElement("value");
        if(enableCompression )
        {
            Base64Encoder encoder = new Base64Encoder();
            CompressionHelper zip = new CompressionHelper();
            byte[] val = zip.compress(vo.getVersionValue());
            value.addCDATA(encoder.encode(val));
        }
        else
        {
          value.addCDATA(URLEncoder.encode(vo.getVersionValue(),"UTF-8"));
        }
View Full Code Here

      md.update(plaintext.getBytes("UTF-8")); // step 3
    } catch (UnsupportedEncodingException e) {
      throw new PasswordException(e.getMessage());
    }
    byte raw[] = md.digest(); // step 4
    String hash = (new Base64Encoder()).encode(raw); // step 5
    return hash; // step 6
  }
View Full Code Here

      md.update(plaintext.getBytes("UTF-8")); // step 3
    } catch (UnsupportedEncodingException e) {
      throw new PasswordException(e.getMessage());
    }
    byte raw[] = md.digest(); // step 4
    String hash = (new Base64Encoder()).encode(raw); // step 5
    return hash; // step 6
  }
View Full Code Here

        String home = getHudsonHome();
        if(!home.endsWith("/"))     home = home + '/'// make sure it ends with '/'

        // check for authentication info
        String auth = new URL(home).getUserInfo();
        if(auth != null) auth = "Basic " + new Base64Encoder().encode(auth.getBytes("UTF-8"));

        {// check if the home is set correctly
            HttpURLConnection con = open(new URL(home));
            if (auth != null) con.setRequestProperty("Authorization", auth);
            con.connect();
View Full Code Here

TOP

Related Classes of com.thoughtworks.xstream.core.util.Base64Encoder

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.