Examples of Base64


Examples of aQute.base64.Base64

    }

  }

  void assertEncode(byte data[]) {
    Base64 b1 = new Base64(data);
    String expected = Base64V.byteArrayToBase64(data);
    System.out.println(expected + "-" + b1);
    assertEquals(expected, b1.toString());
  }
View Full Code Here

Examples of com.alibaba.fastjson.util.Base64

import com.alibaba.fastjson.util.Base64;

public class Base64Test2 extends TestCase {

    public void test_base64_2() throws Exception {
        new Base64();
        String text = "";
        for (int i = 0; i < 1000; ++i) {
            byte[] bytes = text.getBytes("UTF-8");
            {
                String str = com.alibaba.json.test.Base64.encodeToString(bytes, true);
View Full Code Here

Examples of com.nimbusds.jose.util.Base64

    throws Exception {

    URL x5u = new URL("http://example.com/jwk.json");
    Base64URL x5t = new Base64URL("abc");
    List<Base64> x5c = new LinkedList<>();
    x5c.add(new Base64("def"));

    RSAKey key = new RSAKey(new Base64URL(n), new Base64URL(e), new Base64URL(d),
                      new Base64URL(p), new Base64URL(q),
                      new Base64URL(dp), new Base64URL(dq), new Base64URL(qi),
                      null,
View Full Code Here

Examples of com.substanceofcode.utils.Base64

           * Add authentication header in HTTP request. Basic authentication
           * should be formatted like this:
           *     Authorization: Basic QWRtaW46Zm9vYmFy
           */
          String userPass;
          Base64 b64 = new Base64();
          userPass = username + ":" + password;
          userPass = b64.encode(userPass.getBytes());
          m_hc.setRequestProperty("Authorization", "Basic " + userPass);
        }           
        int respCode = m_hc.getResponseCode();
        m_inputStream = m_hc.openInputStream();
        String respMsg = m_hc.getResponseMessage();
View Full Code Here

Examples of com.substanceofcode.utils.Base64

    this serialize does not need to know if Itunes is capable/enabled given
    that no fields were added to make it capable/enabled
    */
    public String serialize() {
        String preData = unencodedSerialize();
        Base64 b64 = new Base64();
        String encodedSerializedData = null;
    try {
      encodedSerializedData = b64.encode( preData.getBytes("UTF-8") );
    } catch (UnsupportedEncodingException e) {
      encodedSerializedData = b64.encode( preData.getBytes() );
    }
    return encodedSerializedData;
  }
View Full Code Here

Examples of com.substanceofcode.utils.Base64

  /** Deserialize the object **/
  public static RssItem deserialize(String encodedData)
  throws CauseMemoryException, CauseException {
    try {
      // Base64 decode
      Base64 b64 = new Base64();
      byte[] decodedData = b64.decode(encodedData);
      String data;
      try {
        data = new String( decodedData, "UTF-8" );
      } catch (UnsupportedEncodingException e) {
        data = new String( decodedData );
View Full Code Here

Examples of com.substanceofcode.utils.Base64

     
      int PASSWORD = 3;
      m_password = nodes[ startIndex + PASSWORD ];
      if (iTunesCapable) {
        // Dencode so that password is not in regular lettters.
        Base64 b64 = new Base64();
        byte[] decodedPassword = b64.decode(m_password);
        try {
          m_password = new String( decodedPassword , "UTF-8" );
        } catch (UnsupportedEncodingException e) {
          m_password = new String( decodedPassword );
        }
        if (hasPipe) {
          m_password = m_password.replace(CONE, '|');
        }
      }
     
      m_items = new Vector();
      if (firstSettings) {
        // Given the bugs with the first settings, we do not
        // retrieve the items so that we can restore them
        // without the bugs.
        return;
      }

      int ITEMS = (iTunesCapable ? ITUNES_ITEMS : 5);
      int UPDDATE = 4;
      String dateString = nodes[startIndex + UPDDATE];
      if(dateString.length()>0) {
        if (iTunesCapable) {
          m_upddate = new Date(Long.parseLong(dateString, 16));
        } else {
          m_upddate = new Date(Long.parseLong(dateString));
        }
      }
      if (iTunesCapable && hasPipe) {
        m_name = m_name.replace(CONE, '|');
      } else {
        if (!iTunesCapable) {
          // Dencode for better UTF-8 and to allow '|' in the name.
          // For iTunesCapable, replace | with (char)1
          Base64 b64 = new Base64();
          byte[] decodedName = b64.decode(m_name);
          try {
            m_name = new String( decodedName , "UTF-8" );
          } catch (UnsupportedEncodingException e) {
            m_name = new String( decodedName );
          }
View Full Code Here

Examples of com.substanceofcode.utils.Base64

    String name = m_name.replace('|', CONE);
    String username = m_username.replace('|' , CONE);
    String password = m_password.replace('|' , CONE);
    String encodedPassword;
    // Encode password to make reading password difficult
        Base64 b64 = new Base64();
    try {
      encodedPassword = b64.encode( m_password.getBytes("UTF-8") );
    } catch (UnsupportedEncodingException e) {
      encodedPassword = b64.encode( m_password.getBytes() );
    }
      String exInfoString;
    String updString;
    if (saveHdr) {
      String dateString;
View Full Code Here

Examples of com.substanceofcode.utils.Base64

    return preData;
  }

    public String serialize() {
        String preData = unencodedSerialize();
        Base64 b64 = new Base64();
        String encodedSerializedData = null;
    try {
      encodedSerializedData = b64.encode( preData.getBytes("UTF-8") );
    } catch (UnsupportedEncodingException e) {
      encodedSerializedData = b64.encode( preData.getBytes() );
    }
    return encodedSerializedData;
  }
View Full Code Here

Examples of com.substanceofcode.utils.Base64

  /** Deserialize the object */
  public static RssItem deserialize(String data)
  throws CauseMemoryException, CauseException {
    try {
      // Base64 decode
      Base64 b64 = new Base64();
      byte[] decodedData = b64.decode(data);
      try {
        data = new String( decodedData, "UTF-8" );
      } catch (UnsupportedEncodingException e) {
        data = new String( decodedData );
      }
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.