Skip to main content

%Net.ChunkedWriter

abstract stream class %Net.ChunkedWriter extends %Library.AbstractStream

%Net.ChunkedWriter provides an interface so that its sub class may be used as an %Net.HttpRequest EntityBody for chunked output from %Net.HttpRequest.

In order to do chunked output from %Net.HttpRequest, a subclass of %Net.ChunkedWriter must be created which implements the OutputStream method. This subclass of %Net.ChunkedWriter is then assigned to the EntityBody property of %Net.HttpRequest which uses the OutputStream method of this class to produce the chunked output.

If the entire request body fits in one buffer, OutputStream is implemented by calling WriteSingleChunk(buffer).

If the entire request is multiple buffers, then WriteFirstChunk(buffer) is called followed by 0 or more calls to WriteChunk(buffer) followed by a call to WriteLastChunk(buffer). WriteLastChunk may be called with the last buffer of output or with the empty string as its argument if no more output is required.

The TranslateTable property may be set to force automatic translation of the chunks as they are written.

Property Inventory

Method Inventory

Properties

property SentChars as %Integer [ InitialExpression = 0 ];
Number of characters we send
Property methods: SentCharsDisplayToLogical(), SentCharsGet(), SentCharsIsValid(), SentCharsLogicalToDisplay(), SentCharsNormalize(), SentCharsSet()
property TranslateTable as %String [ InitialExpression = "RAW" ];
Translate table to be used for outputting the buffer. See Translation Tables.

Property methods: TranslateTableDisplayToLogical(), TranslateTableGet(), TranslateTableIsValid(), TranslateTableLogicalToDisplay(), TranslateTableLogicalToOdbc(), TranslateTableNormalize(), TranslateTableSet()

Methods

method Clear() as %Status
Just return ok
method OutputStream()
Abstract method to be overridden by subclass to do the chunked output using the utility functions defined by this abstract super class.
method WriteChunk(buffer As %String)
Write a chunk.
method WriteFirstChunk(buffer As %String)
Write the Transfer-Encoding: chunked header followed by the first chunk,
method WriteLastChunk(buffer As %String)
Write the last chunk followed by a zero length chunk to mark the end.
method WriteSingleChunk(buffer As %String)
Write the Content-Length HTTP header followed by the entity body as a single chunk. This is used to output the data as not chunked if its length can be determined.

Inherited Members

Inherited Properties

Inherited Methods

FeedbackOpens in a new tab