Published on InterSystems Developer Community (https://community.intersystems.com)

Home > Difference between %Stream.FileCharacter and %FileBinaryStream

Question
Scott Roth · Apr 19, 2017

Difference between %Stream.FileCharacter and %FileBinaryStream

Awhile back we had someone write some code to Log messages like we did in eGate but with Ensemble.

ClassMethod LogIt(pComponent As %String, pMsgIn As %String)
{
 set vDIR="/ensemble/"_^OSUWMCInstance_"/logs/"
 set fs=##class(%Stream.FileCharacter).%New()
 set fs.Filename=vDIR_pComponent_".log"
 do fs.MoveToEnd()
 set vTM=$PIECE($ZDATETIME($HOROLOG)," ",2)
 //$ZTIME($PIECE($H,",",2),1)
 do fs.WriteLine(vTM_" : "_pMsgIn)
 do fs.%Save()
 set fs = "" // Close file
}

We found that the IO on this was slowing messages down, and those Operations that had high volume of message would fall behind. I have used %FileBinaryStream before on other items trying to write files. What is the difference between %Stream.FileCharacter and %FileBinaryStream? Is there a difference in throughput?

Thanks

Scott Roth

The Ohio State University Wexner Medical Center

#Object Data Model #Caché

Source URL:https://community.intersystems.com/post/difference-between-streamfilecharacter-and-filebinarystream