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.33 date: 2024/03/19 12:07:49
user: cg
file: ObjectCoder.st directory: libbasic
module: stx stc-classLibrary: libbasic

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:]

copyright

COPYRIGHT (c) 2000 by eXept Software AG All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the inclusion of the above copyright notice. This software may not be provided or otherwise made available to, or used by, any other person. No title to or ownership of the software is hereby transferred.

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 must be redefined in concrete classes (subclassResponsibility) **

encoding
o  encode: anObject

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.
Anser anObject

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

o  nextPutAll: aCollectionOfObjects
encode all objects from the argument.
Answer the receiver

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 a concrete 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 must be redefined in concrete classes (subclassResponsibility) **

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.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Fri, 26 Jul 2024 23:44:37 GMT