本文整理汇总了VB.NET中System.Xml.XmlWriter.WriteBinHex方法的典型用法代码示例。如果您正苦于以下问题:VB.NET XmlWriter.WriteBinHex方法的具体用法?VB.NET XmlWriter.WriteBinHex怎么用?VB.NET XmlWriter.WriteBinHex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlWriter
的用法示例。
在下文中一共展示了XmlWriter.WriteBinHex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: BinHexEncodeImageFile
Public Shared Sub BinHexEncodeImageFile()
Dim bufferSize As Integer = 1000
Dim buffer(bufferSize) As Byte
Dim readBytes As Integer = 0
Using writer As XmlWriter = XmlWriter.Create("output.xml")
Dim inputFile As New FileStream("C:\artFiles\sunset.jpg", FileMode.OpenOrCreate, FileAccess.Read, FileShare.Read)
writer.WriteStartDocument()
writer.WriteStartElement("image")
Dim br As New BinaryReader(inputFile)
Console.WriteLine(vbCr + vbLf + "Writing BinHex data...")
Do
readBytes = br.Read(buffer, 0, bufferSize)
writer.WriteBinHex(buffer, 0, readBytes)
Loop While bufferSize <= readBytes
br.Close()
writer.WriteEndElement() ' </image>
writer.WriteEndDocument()
End Using
End Sub