Buffer Component
Overview
The Buffer component can be used to read and write text and binary files. It can Base64 encode data and compute an MD5 checksum.This component can be used in environments that support COM such as Active Server Pages, Windows Scripting Host, Visual Basic, etc.
- License
- Freeware
- Type
- 32-bit ActiveX DLL
- Version
- 2.1
- File Name
- XBuffer.dll
- Download Package
- x-buffer.zip
Download
Download Buffer Component
Installation Instructions
- Move the dll to a directory like: C:\Program Files\XStandard\Bin\.
- Open a command prompt and
cd
to the directory where the dll is located. - Type regsvr32 XBuffer.dll or on 64-bit OS type C:\Windows\SysWOW64\regsvr32.exe XBuffer.dll
- Grant "Read & Execute" file permissions on this dll to Everyone.
Note, the command prompt must be "Run as administrator" as shown in the screen shot below.
Uninstall Instructions
- Open a command prompt and
cd
to the directory where the dll is located. - Type regsvr32 -u XBuffer.dll or on 64-bit OS type C:\Windows\SysWOW64\regsvr32.exe -u XBuffer.dll
Usage from 64-bit OS
Please see instructions for 64-bit OS usage.
API Reference: ProgID: XStandard.Buffer
Property Base64String As String
Returns the contents of the buffers as a Base64 encoded string.
Property BlockSize As Long
Internal memory structure size. Used for optimization.
Property Length As Long
(read-only)
Amount of data in the buffer in bytes.
Sub Load(sFileName As String)
Loads contents of a file into the buffer.
Property MD5 As String
Calculates an MD5 checksum on the contents of the buffer.
Sub Reset()
Removes all data from the buffer.
Property SafeArray As Variant
(read-only)
Returns the contents of the buffer as a SafeArray.
Sub SaveAs(sPath As String, [bUnicode As Boolean = False])
Saves the data in the buffer to a file.
Property String As String
(read-only)
Returns the contents of the buffer as a string.
Sub Write(Source As Variant)
Appends data to the contents of the buffer.
Examples
The examples below are for Active Server Pages. For Windows Scripting Host or Visual Basic, replace Server.CreateObject
with CreateObject
and replace Resonse.Write
with MsgBox
.
How to read an image from a file and send it to the browser
<%
Dim objBuffer
Set objBuffer = Server.CreateObject("XStandard.Buffer")
objBuffer.Load "C:\Temp\jump.jpg"
Response.ContentType = "image/jpeg"
Response.AddHeader "Content-Disposition", "inline; filename=jump.jpg"
Response.BinaryWrite objBuffer.SafeArray
Set objBuffer = Nothing
%>
How to write data to a file
<%
Dim objBuffer
Set objBuffer = Server.CreateObject("XStandard.Buffer")
objBuffer.Write "The quick brown fox jumped over the lazy dog." & vbCrLf
objBuffer.Write "Mary had a little lamb"
objBuffer.SaveAs "C:\Temp\myfile.txt"
Set objBuffer = Nothing
%>