EncodedStream.st
author Claus Gittinger <cg@exept.de>
Tue, 09 Mar 2004 23:01:20 +0100
changeset 8148 dbf64e3142d9
parent 8147 416bcaa573ef
child 8165 d6446fc1ea3b
permissions -rw-r--r--
*** empty log message ***
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8148
dbf64e3142d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8147
diff changeset
     1
"
dbf64e3142d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8147
diff changeset
     2
 COPYRIGHT (c) 2004 by eXept Software AG
dbf64e3142d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8147
diff changeset
     3
              All Rights Reserved
dbf64e3142d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8147
diff changeset
     4
dbf64e3142d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8147
diff changeset
     5
 This software is furnished under a license and may be used
dbf64e3142d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8147
diff changeset
     6
 only in accordance with the terms of that license and with the
dbf64e3142d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8147
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
dbf64e3142d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8147
diff changeset
     8
 be provided or otherwise made available to, or used by, any
dbf64e3142d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8147
diff changeset
     9
 other person.  No title to or ownership of the software is
dbf64e3142d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8147
diff changeset
    10
 hereby transferred.
dbf64e3142d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8147
diff changeset
    11
"
dbf64e3142d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8147
diff changeset
    12
8047
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
"{ Package: 'stx:libbasic' }"
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
Stream subclass:#EncodedStream
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
	instanceVariableNames:'encoder stream'
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	classVariableNames:''
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	poolDictionaries:''
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	category:'Collections-Text-Encodings'
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
!
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
8148
dbf64e3142d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8147
diff changeset
    22
!EncodedStream class methodsFor:'documentation'!
dbf64e3142d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8147
diff changeset
    23
dbf64e3142d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8147
diff changeset
    24
copyright
dbf64e3142d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8147
diff changeset
    25
"
dbf64e3142d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8147
diff changeset
    26
 COPYRIGHT (c) 2004 by eXept Software AG
dbf64e3142d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8147
diff changeset
    27
              All Rights Reserved
dbf64e3142d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8147
diff changeset
    28
dbf64e3142d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8147
diff changeset
    29
 This software is furnished under a license and may be used
dbf64e3142d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8147
diff changeset
    30
 only in accordance with the terms of that license and with the
dbf64e3142d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8147
diff changeset
    31
 inclusion of the above copyright notice.   This software may not
dbf64e3142d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8147
diff changeset
    32
 be provided or otherwise made available to, or used by, any
dbf64e3142d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8147
diff changeset
    33
 other person.  No title to or ownership of the software is
dbf64e3142d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8147
diff changeset
    34
 hereby transferred.
dbf64e3142d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8147
diff changeset
    35
"
dbf64e3142d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8147
diff changeset
    36
! !
8047
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
!EncodedStream class methodsFor:'instance creation'!
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
stream:streamArg encoder:encoder
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
    ^ (self basicNew) stream:streamArg; encoder:encoder
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
! !
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
!EncodedStream methodsFor:'accessing'!
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
encoder
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
    ^ encoder
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
!
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
encoder:something
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
    encoder := something.
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
!
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
stream
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
    ^ stream
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
!
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
stream:something
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
    stream := something.
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
! !
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
!EncodedStream methodsFor:'stream protocol'!
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
8147
416bcaa573ef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 8047
diff changeset
    64
nextChunk
416bcaa573ef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 8047
diff changeset
    65
    ^ encoder decodeString:(stream nextChunk)
416bcaa573ef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 8047
diff changeset
    66
!
416bcaa573ef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 8047
diff changeset
    67
8047
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
nextPut:aCharacter
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
    self nextPutAll:(aCharacter asString).
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
!
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
nextPutAll:aCollection
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
    stream nextPutAll:(encoder encodeString:aCollection).
8147
416bcaa573ef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 8047
diff changeset
    74
!
416bcaa573ef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 8047
diff changeset
    75
416bcaa573ef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 8047
diff changeset
    76
position1Based:newPosition
416bcaa573ef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 8047
diff changeset
    77
    stream position1Based:newPosition
8047
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
! !
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
!EncodedStream class methodsFor:'documentation'!
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
version
8148
dbf64e3142d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8147
diff changeset
    83
    ^ '$Header: /cvs/stx/stx/libbasic/EncodedStream.st,v 1.3 2004-03-09 21:57:33 cg Exp $'
8047
9cfc575512eb initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
! !