Examples of BASE64Encoder


Examples of sun.misc.BASE64Encoder

    assertEquals("<b>b</b>", Atom_0_3_Parser.getValue(elt));
  }

  public void testBase64Content() throws Exception {
    Element elt = new Element("summary");
    BASE64Encoder enc = new BASE64Encoder();
    elt.addContent(enc.encode("<b>b</b>".getBytes()));
    elt.setAttribute("mode", "base64");
    assertEquals("<b>b</b>", Atom_0_3_Parser.getValue(elt));
  }
View Full Code Here

Examples of sun.misc.BASE64Encoder

     * @return String der verschluesselte Text mit BASE64 Kodierung.
     * @throws java.lang.Exception
     */
    public static String encrypt( String text, String algName ) throws Exception {

      BASE64Encoder encoder = null;
      MessageDigest md      = null;
      encoder = new BASE64Encoder();
      md = MessageDigest.getInstance(algName);
      md.reset();
      md.update(text.getBytes());
      return encoder.encode(md.digest());

    }
View Full Code Here

Examples of sun.misc.BASE64Encoder

  public static String getMd5(String password){
    String str = "";
    if(password !=null && !password.equals("")){
      try {
        MessageDigest md = MessageDigest.getInstance("MD5");
        BASE64Encoder base = new BASE64Encoder();
        //加密后的字符串
        str = base.encode(md.digest(password.getBytes("utf-8")));
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
    return str;
View Full Code Here

Examples of sun.misc.BASE64Encoder

    } catch (UnsupportedEncodingException e) {
      throw new ControllerException(e.getMessage());
    }

    byte raw[] = md.digest(); //step 4
    String hash = (new BASE64Encoder()).encode(raw); //step 5
    return hash; //step 6
  }
View Full Code Here

Examples of sun.misc.BASE64Encoder

        BufferedImage image = ImageIO.read(new File(filePath));
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
            ImageIO.write(image, type, bos);
            byte[] imageBytes = bos.toByteArray();

            BASE64Encoder encoder = new BASE64Encoder();
            imageString = encoder.encode(imageBytes);
        //    Base64.encodeBase64String(fileContent);
           

            bos.close();
        } catch (IOException e) {
View Full Code Here

Examples of sun.misc.BASE64Encoder

  }

  public void setMaiSubject(String paramString) throws MessagingException {
    try {
      this.maiSubject = paramString;
      BASE64Encoder localBASE64Encoder = new BASE64Encoder();
      this.message.setSubject("=?GBK?B?"
          + localBASE64Encoder.encode(paramString.getBytes()) + "?=");
    } catch (Exception localException) {
      localException.printStackTrace();
    }
  }
View Full Code Here

Examples of sun.misc.BASE64Encoder

            connection.disconnect();
        }

        //Authenticate
        connection = (HttpURLConnection) new URL("http://localhost:8181" + contextPath).openConnection();
        String authentication = (new BASE64Encoder()).encode(("alan:starcraft").getBytes());
        connection.setRequestProperty("Authorization", "Basic " + authentication);
        try {
            BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
            assertEquals(HttpURLConnection.HTTP_OK, connection.getResponseCode());
            assertEquals("Hello World", reader.readLine());
View Full Code Here

Examples of sun.misc.BASE64Encoder

   
    public static void downloadUrl(final String url) throws IOException {
        final URL downloader = new URL(url);
        final URLConnection urlConnection = downloader.openConnection();
        if (null != downloader.getUserInfo()) {
            BASE64Encoder encoder = new BASE64Encoder();
            final String basicAuth = "Basic " + new String(encoder.encode(
                    downloader.getUserInfo().getBytes()));
            urlConnection.setRequestProperty("Authorization", basicAuth);
        }
        final BufferedReader inputStream = new BufferedReader(new InputStreamReader(
                urlConnection.getInputStream()));
View Full Code Here

Examples of sun.misc.BASE64Encoder

   * @param key
   * @return
   * @throws Exception
   */
  public static String encryptBASE64(byte[] key) throws Exception {
    return (new BASE64Encoder()).encodeBuffer(key);
  }
View Full Code Here

Examples of sun.misc.BASE64Encoder

   * @param key
   * @return
   * @throws Exception
   */
  public static String encryptBASE64(byte[] key) throws Exception {
    return (new BASE64Encoder()).encodeBuffer(key);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.