Home > Class Reference > ENSLIB namespace > %Net.ChunkedWriter
Private  Storage   


abstract stream class %Net.ChunkedWriter extends

%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.


Parameters Properties Methods Queries Indices ForeignKeys Triggers
2 7


%Location AtEnd Attributes Id LastModified
LineTerminator SentChars Size TranslateTable

%AddToSaveSet %CheckUnique %ClassIsLatestVersion %ClassName
%ConstructClone %Delete %DeleteExtent %DeleteId
%DispatchClassMethod %DispatchGetModified %DispatchGetProperty %DispatchMethod
%DispatchSetModified %DispatchSetMultidimProperty %DispatchSetProperty %Exists
%ExistsId %Extends %GetParameter %GetSwizzleObject
%Id %IsA %IsModified %IsNull
%KillExtent %LOBPrefetch %LocationSet %LockStream
%New %NormalizeObject %ObjectIsNull %ObjectModified
%ObjectSize %Oid %Open %OpenId
%OriginalNamespace %PackageName %ReleaseLock %Reload
%RemoveFromSaveSet %RollBack %Save %SerializeObject
%SetModified %UnlockStream %ValidateObject Clear
CopyFrom CopyFromAndSave DeleteAttribute DeleteStream
FindAt Flush GetAttribute GetAttributeList
GetStreamId InputFromDevice IsCharacter IsDefinedAttribute
IsNull LastModifiedGet LineTerminatorSet MoveTo
MoveToEnd NextAttribute OpenStream OutputStream
OutputToDevice OutputToDeviceAt Read ReadLine
ReadLineIntoStream ReadSQL Rewind SaveStream
SerializeToSyncSet SetAttribute SetAttributeList SizeGet
StreamOIDIsNull SyncStreamIn Write WriteChunk
WriteFirstChunk WriteLastChunk WriteLine WriteSingleChunk



• property SentChars as %Integer [ InitialExpression = 0 ];
Number of characters we send
• property TranslateTable as %String [ InitialExpression = "RAW" ];
Translate table to be used for outputting the buffer.


• 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.