Package com.substanceofcode.utils

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


    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

    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

  /** 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

    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

  /** 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

Related Classes of com.substanceofcode.utils.Base64

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.