• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 391
  • Last Modified:

VB.Net and binary buffer

We have a program we're replacing that is currently written in C/C++.

I reads/write data into an XML element with some low-level, hard-core code (the whole thing is hard core, this particular bit may not be so bad).

Anyway, it's old and was done before .Net and we want to replace to make maintenance and enhancement easier.

We're looking for some VB.Net that will read/write the content of an XML element with data from a buffer (which contains data we get from off the network).  This data is binary (not text).  We're looking for an example of code that can read/write binary data like this.
0
Gene Klamerus
Asked:
Gene Klamerus
  • 3
  • 2
1 Solution
 
Bob LearnedCommented:
1) You can use text encoders to convert byte arrays to strings

  Dim text As String = System.Text.Encoding.Utf8.GetBytes(buffer)

2) What does the XML text look like?

3) What kind of information are you looking to extract?

Bob
0
 
Gene KlamerusTechnical ArchitectAuthor Commented:
The XML is just a complex XML structure.  One of the elements is binary data (a PDF file encoded).

We need to extract the contents of that elements into an in-memory buffer for manipulation (as binary data).
0
 
Bob LearnedCommented:
Is the binary data stored in a CDATA element?

Bob
0
 
Gene KlamerusTechnical ArchitectAuthor Commented:
no, it's bin64 encoded.
0
 
Bob LearnedCommented:
You can convert to/from Base-64 with Convert.ToBase64String/Convert.FromBase64String.  

It's difficult to give you any kind of intelligent answer without understanding more about what you are trying to do.

Bob
            
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now