Xceed Binary Encoding Library Documentation
Examples / Encoding and decoding from memory to file (VB.NET example)
In This Topic
    Encoding and decoding from memory to file (VB.NET example)
    In This Topic

    This sample encodes with the Base64 format from memory to a file and decodes the encoded data from file to memory.

    VB.NET Copy Code

    Dim encoder As New XceedBinaryEncodingLib.XceedBinaryEncodingClass() 

    encoder.License( "your license key" )      

    Try
      encoder.EncodingFormat = New XceedBinaryEncodingLib.XceedBase64EncodingFormatClass()        

      Dim data As Object = "This is the data to encode" 

      ' Encoded the data to file
      encoder.WriteFile( data, XceedBinaryEncodingLib.EXBFileProcessing.bfpEncode, _
                         true, "c:\test\encoded.txt", false ) 

      Dim bytesRead As Object = Nothing 

      ' Decode the encoded data located in the file to memory.
      Dim decodedData As Object = encoder.ReadFile( "c:\test\encoded.txt",0,0, _
                              XceedBinaryEncodingLib.EXBFileProcessing.bfpDecode ,true, bytesRead )
      

      MessageBox.Show( System.Text.Encoding.Unicode.GetString( CType( decodedData, byte() ) ) )Catch except As System.Runtime.InteropServices.COMException
      MessageBox.Show( except.ToString() )
    End Try