本文整理匯總了VB.NET中System.Xml.XmlTextReader.ReadBinHex方法的典型用法代碼示例。如果您正苦於以下問題:VB.NET XmlTextReader.ReadBinHex方法的具體用法?VB.NET XmlTextReader.ReadBinHex怎麽用?VB.NET XmlTextReader.ReadBinHex使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Xml.XmlTextReader
的用法示例。
在下文中一共展示了XmlTextReader.ReadBinHex方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: Sample
Option Explicit
Option Strict
Imports System.IO
Imports System.Xml
Public Class Sample
Private Const filename As String = "binary.xml"
Public Shared Sub Main()
Dim reader As XmlTextReader = Nothing
Dim i As Integer
Try
reader = New XmlTextReader(filename)
reader.WhitespaceHandling = WhitespaceHandling.None
' Read the file. Stop at the Base64 element.
While reader.Read()
If "Base64" = reader.Name Then
Exit While
End If
End While
' Read the Base64 data. Write the decoded
' bytes to the console.
Console.WriteLine("Reading base64... ")
Dim base64len As Integer = 0
Dim base64(1000) As Byte
Do
base64len = reader.ReadBase64(base64, 0, 50)
For i = 0 To base64len - 1
Console.Write(base64(i))
Next i
Loop While (reader.Name = "Base64")
' Read the BinHex data. Write the decoded
' bytes to the console.
Console.WriteLine(ControlChars.CrLf & "Reading binhex....")
Dim binhexlen As Integer = 0
Dim binhex(1000) As Byte
binhexlen = reader.ReadBinHex(binhex, 0, 50)
Do
binhexlen = reader.ReadBinHex(binhex, 0, 50)
For i = 0 To binhexlen - 1
Console.Write(binhex(i))
Next i
Loop While (reader.Name = "BinHex")
Finally
Console.WriteLine()
Console.WriteLine("Processing of the file {0} complete.", filename)
If Not (reader Is Nothing) Then
reader.Close()
End If
End Try
End Sub
End Class