Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to Extract gZip Base64 encoded Data

Posted on 2009-04-09
2
Medium Priority
?
4,482 Views
Last Modified: 2013-12-17
VS2008
I have a File (xfdl) that is encoded base64 and compressed using gzip. When I open the File with Notepad I can read the first line.
application/vnd.xfdl;content-encoding="base64-gzip"
Is there a Lib (free if possible) that I can Use from VB.NET to gzip/gunzip Files? and Encode/Decode Base64?
0
Comment
Question by:ofern01
  • 2
2 Comments
 
LVL 2

Expert Comment

by:T0ni
ID: 24106751
To gzip/gunzip (a free library):
http://www.icsharpcode.net/OpenSource/SharpZipLib/

To Encode/Decode Base64 (code below):


        public string Encode(string str)
        {
            byte[] encbuff = System.Text.Encoding.UTF8.GetBytes(str);
            return Convert.ToBase64String(encbuff);
        }
        public string Decode(string str)
        {
            byte[] decbuff = Convert.FromBase64String(str);
            return System.Text.Encoding.UTF8.GetString(decbuff);
        }

Open in new window

0
 
LVL 2

Accepted Solution

by:
T0ni earned 2000 total points
ID: 24106979
Sorry thought I was in the C# section..
Here is the code to Encode/Decode Base64 in VB.NET:

    Public Function Encode(ByVal str As String) As String
        Dim encbuff As Byte() = System.Text.Encoding.UTF8.GetBytes(str)
        Return (Convert.ToBase64String(encbuff))
    End Function
 
    Public Function Decode(ByVal str As String) As String
        Dim decbuff As Byte() = Convert.FromBase64String(str)
        Return (System.Text.Encoding.UTF8.GetString(decbuff))
    End Function

Open in new window

0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Integration Management Part 2
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question