{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-guides/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Class: BrowserMemoryStream","description":"Accelerate E&P application development and protect your innovation by consuming our Data and Domain APIs / Platform APIs.","lang":"en-US","meta":[{"name":"robots","content":"noindex"}],"llmstxt":{"hide":true,"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/solutions/geotoolkit/apis/readme"},"children":["API"]}," / ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/solutions/geotoolkit/apis/modules/geotoolkit"},"children":["geotoolkit"]}," / ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/solutions/geotoolkit/apis/modules/geotoolkit.util"},"children":["util"]}," / ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/solutions/geotoolkit/apis/modules/geotoolkit.util.stream"},"children":["stream"]}," / ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/solutions/geotoolkit/apis/modules/geotoolkit.util.stream.browsermemorystream"},"children":["BrowserMemoryStream"]}," / BrowserMemoryStream"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"class-browsermemorystream","__idx":0},"children":["Class: BrowserMemoryStream"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/solutions/geotoolkit/apis/modules/geotoolkit.util.stream"},"children":["stream"]},".",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/solutions/geotoolkit/apis/modules/geotoolkit.util.stream.browsermemorystream"},"children":["BrowserMemoryStream"]},".BrowserMemoryStream"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A stream implementation using a browser ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer"},"children":["ArrayBuffer"]}," as backing store.",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]}," ","(Use BrowserMemoryStream.stringToArrayBuffer to convert a string into an ArrayBuffer).",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]}," ","This implementation provides compatibility with stream-based mechanism for dataset that are already in memory.",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]}," ",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]}," ","Note that this class relies on the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://w3c.github.io/FileAPI/"},"children":["HTML5 File API"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"implements","__idx":1},"children":["Implements"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/solutions/geotoolkit/apis/classes/geotoolkit.util.stream.ireadable.ireadable"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["IReadable"]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"table-of-contents","__idx":2},"children":["Table of contents"]},{"$$mdtype":"Tag","name":"details","attributes":{"open":"true"},"children":[{"$$mdtype":"Tag","name":"summary","attributes":{},"children":[{"$$mdtype":"Tag","name":"span","attributes":{"style":{"fontSize":"1.25em","fontWeight":"bold"}},"children":["Constructors"]}]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/solutions/geotoolkit/apis/classes/geotoolkit.util.stream.browsermemorystream.browsermemorystream#new-browsermemorystreamoptions"},"children":["new BrowserMemoryStream(options)"]}]}]}]},{"$$mdtype":"Tag","name":"details","attributes":{"open":"true"},"children":[{"$$mdtype":"Tag","name":"summary","attributes":{},"children":[{"$$mdtype":"Tag","name":"span","attributes":{"style":{"fontSize":"1.25em","fontWeight":"bold"}},"children":["Methods"]}]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":""},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/solutions/geotoolkit/apis/classes/geotoolkit.util.stream.browsermemorystream.browsermemorystream#dispose"},"children":["dispose"]}]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":""},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/solutions/geotoolkit/apis/classes/geotoolkit.util.stream.browsermemorystream.browsermemorystream#getsize"},"children":["getSize"]}]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":""},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/solutions/geotoolkit/apis/classes/geotoolkit.util.stream.browsermemorystream.browsermemorystream#getstride"},"children":["getStride"]}]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/solutions/geotoolkit/apis/classes/geotoolkit.util.stream.browsermemorystream.browsermemorystream#readchunk"},"children":["readChunk"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/solutions/geotoolkit/apis/classes/geotoolkit.util.stream.browsermemorystream.browsermemorystream#stringtoarraybuffer"},"children":["stringToArrayBuffer"]}]}]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"contents","__idx":3},"children":["Contents"]},{"$$mdtype":"Tag","name":"details","attributes":{"open":"true"},"children":[{"$$mdtype":"Tag","name":"summary","attributes":{},"children":[{"$$mdtype":"Tag","name":"span","attributes":{"style":{"fontSize":"1.25em","fontWeight":"bold"}},"children":["Constructors"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"new-browsermemorystreamoptions","__idx":4},"children":["new BrowserMemoryStream(options)"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["• ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["new BrowserMemoryStream"]},"(",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["options"]},")"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters","__idx":5},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"width":"65%","data-label":"Name"},"children":["Name "]},{"$$mdtype":"Tag","name":"th","attributes":{"width":"35%","data-label":"Type"},"children":["Type "]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["options"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/solutions/geotoolkit/apis/modules/geotoolkit.util.stream.browsermemorystream.browsermemorystream#options"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Options"]}]}]}]}]}]}]}]},{"$$mdtype":"Tag","name":"details","attributes":{"open":"true"},"children":[{"$$mdtype":"Tag","name":"summary","attributes":{},"children":[{"$$mdtype":"Tag","name":"span","attributes":{"style":{"fontSize":"1.25em","fontWeight":"bold"}},"children":["Methods"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"dispose","__idx":6},"children":["dispose"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["▸ ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["dispose"]},"(): ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["void"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Dispose"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"returns","__idx":7},"children":["Returns"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["void"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"implementation-of","__idx":8},"children":["Implementation of"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/solutions/geotoolkit/apis/classes/geotoolkit.util.stream.ireadable.ireadable"},"children":["IReadable"]},".",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/solutions/geotoolkit/apis/classes/geotoolkit.util.stream.ireadable.ireadable#dispose"},"children":["dispose"]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"getsize","__idx":9},"children":["getSize"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["▸ ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["getSize"]},"(): ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["number"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Returns the size of the underlying data"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"returns-1","__idx":10},"children":["Returns"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["number"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["size The size"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"implementation-of-1","__idx":11},"children":["Implementation of"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/solutions/geotoolkit/apis/classes/geotoolkit.util.stream.ireadable.ireadable"},"children":["IReadable"]},".",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/solutions/geotoolkit/apis/classes/geotoolkit.util.stream.ireadable.ireadable#getsize"},"children":["getSize"]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"getstride","__idx":12},"children":["getStride"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["▸ ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["getStride"]},"(): ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["number"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Returns the stride of this stream"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"returns-2","__idx":13},"children":["Returns"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["number"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["stride The stride"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"implementation-of-2","__idx":14},"children":["Implementation of"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/solutions/geotoolkit/apis/classes/geotoolkit.util.stream.ireadable.ireadable"},"children":["IReadable"]},".",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/solutions/geotoolkit/apis/classes/geotoolkit.util.stream.ireadable.ireadable#getstride"},"children":["getStride"]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"readchunk","__idx":15},"children":["readChunk"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["▸ ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["readChunk"]},"(",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["offset"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["length"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["callback"]},"): ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/solutions/geotoolkit/apis/classes/geotoolkit.util.stream.browsermemorystream.browsermemorystream"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["BrowserMemoryStream"]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Read a chunk of data and calls the callback when it's done."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-1","__idx":16},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"width":"30%","data-label":"Name"},"children":["Name "]},{"$$mdtype":"Tag","name":"th","attributes":{"width":"20%","data-label":"Type"},"children":["Type "]},{"$$mdtype":"Tag","name":"th","attributes":{"width":"50%","data-label":"Description"},"children":["Description "]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["offset"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["number"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The position to start reading from"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["length"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["number"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The amount of bytes to read"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["callback"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["(",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["err"]},": ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Error"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["buffer"]},": ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Int8Array"]}," | ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Int16Array"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["bytesRead"]},": ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["number"]},") => ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["void"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The callback that will be called with the result"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"returns-3","__idx":17},"children":["Returns"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/solutions/geotoolkit/apis/classes/geotoolkit.util.stream.browsermemorystream.browsermemorystream"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["BrowserMemoryStream"]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["this"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"implementation-of-3","__idx":18},"children":["Implementation of"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/solutions/geotoolkit/apis/classes/geotoolkit.util.stream.ireadable.ireadable"},"children":["IReadable"]},".",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/solutions/geotoolkit/apis/classes/geotoolkit.util.stream.ireadable.ireadable#readchunk"},"children":["readChunk"]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"stringtoarraybuffer","__idx":19},"children":["stringToArrayBuffer"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["▸ ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Static"]}," ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["stringToArrayBuffer"]},"(",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["string"]},"): ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ArrayBuffer"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Converts a String in an ArrayBuffer using String.charCodeAt (encoding is forced to utf16)."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-2","__idx":20},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"width":"30%","data-label":"Name"},"children":["Name "]},{"$$mdtype":"Tag","name":"th","attributes":{"width":"20%","data-label":"Type"},"children":["Type "]},{"$$mdtype":"Tag","name":"th","attributes":{"width":"50%","data-label":"Description"},"children":["Description "]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The string to convert"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"returns-4","__idx":21},"children":["Returns"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ArrayBuffer"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["buffer The resulting ArrayBuffer"]}]}]},"headings":[{"value":"Class: BrowserMemoryStream","id":"class-browsermemorystream","depth":1},{"value":"Implements","id":"implements","depth":2},{"value":"Table of contents","id":"table-of-contents","depth":2},{"value":"Contents","id":"contents","depth":2},{"value":"new BrowserMemoryStream(options)","id":"new-browsermemorystreamoptions","depth":4},{"value":"Parameters","id":"parameters","depth":4},{"value":"dispose","id":"dispose","depth":4},{"value":"Returns","id":"returns","depth":4},{"value":"Implementation of","id":"implementation-of","depth":4},{"value":"getSize","id":"getsize","depth":4},{"value":"Returns","id":"returns-1","depth":4},{"value":"Implementation of","id":"implementation-of-1","depth":4},{"value":"getStride","id":"getstride","depth":4},{"value":"Returns","id":"returns-2","depth":4},{"value":"Implementation of","id":"implementation-of-2","depth":4},{"value":"readChunk","id":"readchunk","depth":4},{"value":"Parameters","id":"parameters-1","depth":4},{"value":"Returns","id":"returns-3","depth":4},{"value":"Implementation of","id":"implementation-of-3","depth":4},{"value":"stringToArrayBuffer","id":"stringtoarraybuffer","depth":4},{"value":"Parameters","id":"parameters-2","depth":4},{"value":"Returns","id":"returns-4","depth":4}],"frontmatter":{"seo":{"title":"Class: BrowserMemoryStream"}},"lastModified":"2026-02-11T19:54:32.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/solutions/geotoolkit/apis/classes/geotoolkit.util.stream.browsermemorystream.browsermemorystream","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}