Search code examples
intersystems-cacheobjectscript

ObjectScript Library.FileBinaryStream convert into a string


How can I create a string a from binary stream? I tried StreamGet and OutputToDevice class methods but that is not returning the string. Is there another class I should use

Thanks :)


Solution

  • Assuming that stream is a %Library.FileBinaryStream:

    set string = stream.Read($$$MaxStringLength)
    

    Note that string can't be more than 7mb, while stream can be bigger.