字符串保存为文件
''' <summary>
''' 将传进来的字符串保存为文件
''' </summary>
''' <param name="savePath">文件保存路径</param>
''' <param name="fullPath">文件全路径</param>
''' <param name="binary">字符串</param>
''' <remarks></remarks>
Public Sub BinaryToFile(ByVal savePath As String, ByVal fullPath As String, ByVal binary As String)
'判断文件保存路径是否存在
If Not Directory.Exists(savePath) Then
Directory.CreateDirectory(savePath)
End If
'判断文件是否存在
If Not File.Exists(fullPath) Then
Dim fs As FileStream = New FileStream(fullPath, FileMode.CreateNew)
'利用新传来的路径实例化一个FileStream对像
Dim bw As BinaryWriter = New BinaryWriter(fs)
'实例化一个用于写的BinaryWriter
Dim byteStreamStr As String = binary.Replace("%2B", "+")
Dim byteStream() As Byte = Convert.FromBase64String(byteStreamStr)
fs.Write(byteStream, 0, byteStream.Length)
bw.Close()
fs.Close()
End If
End Sub