The XHTML WYSIWYG Editor For Desktop & Web Applications

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

  1. Move the dll to a directory like: C:\Program Files\XStandard\Bin\.
  2. Open a command prompt and cd to the directory where the dll is located.
  3. Type regsvr32 XBuffer.dll or on 64-bit OS type C:\Windows\SysWOW64\regsvr32.exe XBuffer.dll
  4. 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.

Context menu for the command prompt showing the option to run as administrator.

Uninstall Instructions

  1. Open a command prompt and cd to the directory where the dll is located.
  2. 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

  1. <%
  2. Dim objBuffer
  3. Set objBuffer = Server.CreateObject("XStandard.Buffer")
  4. objBuffer.Load "C:\Temp\jump.jpg"
  5. Response.ContentType = "image/jpeg"
  6. Response.AddHeader "Content-Disposition", "inline; filename=jump.jpg"
  7. Response.BinaryWrite objBuffer.SafeArray
  8. Set objBuffer = Nothing
  9. %>

How to write data to a file

  1. <%
  2. Dim objBuffer
  3. Set objBuffer = Server.CreateObject("XStandard.Buffer")
  4. objBuffer.Write "The quick brown fox jumped over the lazy dog." & vbCrLf
  5. objBuffer.Write "Mary had a little lamb"
  6. objBuffer.SaveAs "C:\Temp\myfile.txt"
  7. Set objBuffer = Nothing
  8. %>