eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'ObjectCoder':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: ObjectCoder


Inheritance:

   Object
   |
   +--Visitor
      |
      +--AspectVisitor
         |
         +--ObjectCoder
            |
            +--BaseNCoder
            |
            +--JSONPrinter
            |
            +--XMLCoder

Package:
stx:libbasic
Category:
System-Storage
Version:
rev: 1.25 date: 2019/03/22 12:45:30
user: cg
file: ObjectCoder.st directory: libbasic
module: stx stc-classLibrary: libbasic
Author:
Stefan Vogel

Description:


This is an abstract class. Subclasses implement encoding and decoding
of Objects onto resp. from a stream. Possible coders are ASN.1/BER,
CORBA/CDR, BOSS, RMI ...

Classes which implement basic types (Boolean, Integer, Float, ...)
implement the visitor methods #acceptVisitor:with:, which dispatches onto an ObjectCoder.



[instance variables:]
    stream  <Stream>        the stream we read/write the encodings from/to

[class variables:]


Related information:

    OSI::ASN1_Coder

Class protocol:

encoding / decoding
o  decode: aByteArrayOrString
decode aByteArrayOrString

usage example(s):

     Base64Coder encode:#[1 2 16rFe 16rFF]
     Base64Coder decode:'AQL+/w=='    
     (Base64Coder decode:(Base64Coder encode:#[1 2 16rFe 16rFF])) = #[1 2 16rFe 16rFF]

o  decodingOf: anObject
use decode

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  encode: anObject
encode anObject.
Some subclasses (eg. XMLCoder) allow arbitrary objects to be encoded/decoded,
others don't (eg. Base64Coder)

usage example(s):

     Base64Coder encode:#[1 2 16rFe 16rFF]
     Base64Coder encode:'hello'
     OSI::BERCoder encode:'hello'  

o  encode: anObject on: aStream
encode anObject onto a stream
Some subclasses (eg. XMLCoder) allow arbitrary objects to be encoded/decoded,
others don't (eg. Base64Coder)

o  encode: anObject on: aStream with: info
encode anObject onto a stream
Some subclasses (eg. XMLCoder) allow arbitrary objects to be encoded/decoded,
others don't (eg. Base64Coder)

o  encode: anObject with: aParameter
encode anObject onto a stream
Some subclasses (eg. XMLCoder) allow arbitrary objects to be encoded/decoded,
others don't (eg. Base64Coder)

o  encodingOf: anObject
use #encode:

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  encodingOf: anObject with: aParameter
use #encode:with:

** This is an obsolete interface - do not use it (it may vanish in future versions) **

instance creation
o  on: aStream
return an encoder/decoder for a stream


Instance protocol:

accessing
o  contents

decoding
o  next
read, decode and return the next object

** This method raises an error - it must be redefined in concrete classes **

encoding
o  encode: anObject on: aStream

o  encode: anObject on: aStream with: info

o  encodingOf: anObject
answer the encoded argument anObject

o  encodingOf: anObject with: aParameter
answer the encoded argument anObject

o  endEncoding
redefinable - allows subclass to create a file trailer or similar stuff

o  nextPut: anObject
encode anObject onto my stream

o  nextPut: anObject with: aParameter
encode anObject onto my stream

o  nextPutAll: aCollectionOfObjects
encode all objects from the argument

o  startEncoding
redefinable - allows subclass to create a file header or similar stuff

encoding-smalltalk types
o  visitBlock: aBlock with: aParameter
encoding of blocks is rather difficult and an error by default.
If your encoder supports this, redefine it there

initialization
o  close
close the underlying stream

o  emptyWriteStream
answer an empty stream for writing the encoded object

** This method raises an error - it must be redefined in concrete classes **

o  flush
flush possibly internally buffered data.
Nothing is done by default. Subclasses may redefine this

o  reset
reset the coder

private-accessing
o  stream
return my input or output stream

o  stream: aStream
set my input or output stream



ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Fri, 29 Mar 2024 13:06:00 GMT