Namespace: OpenEdge.Net.HTTP.Filter.Payload
Type: Class MessageWriter
Parent Classes:
Inherits: Progress.IO.OutputStream
Implements: OpenEdge.Logging.ISupportLogging


Copyright (c) 2015-2018, 2021 by Progress Software Corporation. All rights reserved.
File:MessageWriter
Purpose:Writes content into an object, like
a JsonObject or String or Memptr or ByteBucket
Author(s):pjudge
Created:Thu Jun 25 15:41:58 EDT 2015
/* An event raised when a writer encounters an error.



Method Summary
  Options Name Purpose
  Close () /** Closes the writer. */
  LogMessage (character, integer)
  LogMessage (character, LogLevelEnum)
  OnWriteError (MessageWriterErrorEventArgs) /* Process a write error 1) publishes the WriteError event 2) Calls the WriteErrorHandler in this object Processes the event args from those calls using Write(args:OutputData). This is to determine the number of bytes written. @param MessageWriterErrorEventArgs (required) The event args for the WriteError event */
  Open () /** Opens the writer for output. Open/Close allows us to write the same message multiple times without requiring a new writer each time. */
  INT64 Write (character) /* no-op */
  INT64 Write (handle) /** Write data to/from the entity @param handle Data to write */
  INT64 Write (longchar) /* no-op */
  INT64 Write (memptr)
  INT64 Write (memptr, int64, int64) /* no-op */
  INT64 Write (Object) /** Write data to/from the entity @param Object Data to write */
  WriteErrorHandler (Object, MessageWriterErrorEventArgs) /* Event handler for WriteError. This isn't abstract because we don't want to require every Entity- and BodyWriter to have to implement this method. Default behaviour is to throw the error. Individual writers should override this method if they want to implement specific behaviour. @param Progress.Lang.Object The type/class raising the event @param MessageWriterErrorEventArgs A set of arguments relating to the error */
  INT64 WriteFileStream (FileInputStream) /** Reads the contents of a file and writes the bytes as memptr @param FileInputStream A valid file stream @return int64 The number of bytes read. */
  INT64 WriteMemoryStream (MemoryOutputStream) /** Reads the contents of a MemptrOutputStream and writes the bytes @param MemptrOutputStream A valid memory stream @return int64 The number of bytes written. */

Constructor Summary
  Options Name Purpose
  MessageWriter (Class) /** Default constructor. */
  MessageWriter (Class, Object) /** Constructor. @param Class The type of the entity - pseudo-generics here. @param Object The 'real' entity being written */

Event Summary
  Options Name Purpose
  WriteError (Object, MessageWriterErrorEventArgs) /* An event raised when a writer encounters an error. @param Progress.Lang.Object The type/class raising the event @param MessageWriterErrorEventArgs A set of arguments relating to the error */

Property Summary
  Options Name Purpose
  Progress.Lang.Object Entity
  Progress.Lang.Class EntityType
  OpenEdge.Logging.ILogWriter Logger


Method Detail
Top

Close ()

Purpose: Closes the writer.
Top

LogMessage (character, integer)

Parameters:
pcMessage CHARACTER
 
piLogLevel INTEGER
 
Top

LogMessage (character, LogLevelEnum)

Parameters:
pcMessage CHARACTER
 
poLogLevel OpenEdge.Logging.LogLevelEnum
 
Top

OnWriteError (MessageWriterErrorEventArgs)

/* Process a write error
1) publishes the WriteError event
2) Calls the WriteErrorHandler in this object
Processes the event args from those calls using Write(args:OutputData). This is to
determine the number of bytes written.
Parameters:
pArgs OpenEdge.Net.HTTP.Filter.Payload.MessageWriterErrorEventArgs
 
Top

Open ()

Purpose: Opens the writer for output. Open/Close allows us to write the same message multiple
times without requiring a new writer each time.
Top

INT64 Write (character)

/* no-op
Parameters:
p0 CHARACTER
 
Returns INT64
 
Top

INT64 Write (handle)

Purpose: Write data to/from the entity
Parameters:
phData HANDLE
 
Returns INT64
 
Top

INT64 Write (longchar)

/* no-op
Parameters:
p0 LONGCHAR
 
Returns INT64
 
Top

INT64 Write (memptr)

Parameters:
p0 MEMPTR
 
Returns INT64
 
Top

INT64 Write (memptr, int64, int64)

/* no-op
Parameters:
p0 MEMPTR
 
p1 INT64
 
p2 INT64
 
Returns INT64
 
Top

INT64 Write (Object)

Purpose: Write data to/from the entity
Parameters:
poData Progress.Lang.Object
 
Returns INT64
 
Top

WriteErrorHandler (Object, MessageWriterErrorEventArgs)

/* Event handler for WriteError. This isn't abstract because we don't want to
require every Entity- and BodyWriter to have to implement this method.
Default behaviour is to throw the error. Individual writers should override this
method if they want to implement specific behaviour.
Parameters:
pSender Progress.Lang.Object
 
pArgs OpenEdge.Net.HTTP.Filter.Payload.MessageWriterErrorEventArgs
 
Top

INT64 WriteFileStream (FileInputStream)

Purpose: Reads the contents of a file and writes the bytes as memptr
Parameters:
pStream Progress.IO.FileInputStream
 
Returns INT64
  int64 The number of bytes read.
Top

INT64 WriteMemoryStream (MemoryOutputStream)

Purpose: Reads the contents of a MemptrOutputStream and writes the bytes
Parameters:
pStream Progress.IO.MemoryOutputStream
 
Returns INT64
  int64 The number of bytes written.


Constructor Detail
Top

MessageWriter (Class)

Purpose: Default constructor.
Parameters:
poType Progress.Lang.Class
 
Top

MessageWriter (Class, Object)

Purpose: Constructor.
Parameters:
poType Progress.Lang.Class
 
poEntity Progress.Lang.Object
 


Event Detail
Top

WriteError (Object, MessageWriterErrorEventArgs)

/* An event raised when a writer encounters an error.
Parameters:
pSender Progress.Lang.Object
 
pArgs OpenEdge.Net.HTTP.Filter.Payload.MessageWriterErrorEventArgs
 


Property Detail
Top

Progress.Lang.Object Entity

Returns Progress.Lang.Object
 
Top

Progress.Lang.Class EntityType

Returns Progress.Lang.Class
 
Top

OpenEdge.Logging.ILogWriter Logger

Returns OpenEdge.Logging.ILogWriter