author | Stefan Vogel <sv@exept.de> |
Tue, 13 Jul 2004 15:10:20 +0200 | |
changeset 8447 | 9bdea3431846 |
parent 8444 | 354d0c48618d |
child 8459 | 1f59b17291a3 |
permissions | -rw-r--r-- |
8148 | 1 |
" |
2 |
COPYRIGHT (c) 2004 by eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
8047 | 13 |
"{ Package: 'stx:libbasic' }" |
14 |
||
8447
9bdea3431846
EncodedStream inherts from PeekableStream
Stefan Vogel <sv@exept.de>
parents:
8444
diff
changeset
|
15 |
PeekableStream subclass:#EncodedStream |
8047 | 16 |
instanceVariableNames:'encoder stream' |
17 |
classVariableNames:'' |
|
18 |
poolDictionaries:'' |
|
19 |
category:'Collections-Text-Encodings' |
|
20 |
! |
|
21 |
||
8148 | 22 |
!EncodedStream class methodsFor:'documentation'! |
23 |
||
24 |
copyright |
|
25 |
" |
|
26 |
COPYRIGHT (c) 2004 by eXept Software AG |
|
27 |
All Rights Reserved |
|
28 |
||
29 |
This software is furnished under a license and may be used |
|
30 |
only in accordance with the terms of that license and with the |
|
31 |
inclusion of the above copyright notice. This software may not |
|
32 |
be provided or otherwise made available to, or used by, any |
|
33 |
other person. No title to or ownership of the software is |
|
34 |
hereby transferred. |
|
35 |
" |
|
36 |
! ! |
|
8047 | 37 |
|
38 |
!EncodedStream class methodsFor:'instance creation'! |
|
39 |
||
40 |
stream:streamArg encoder:encoder |
|
41 |
^ (self basicNew) stream:streamArg; encoder:encoder |
|
42 |
! ! |
|
43 |
||
44 |
!EncodedStream methodsFor:'accessing'! |
|
45 |
||
46 |
encoder |
|
47 |
^ encoder |
|
48 |
! |
|
49 |
||
50 |
encoder:something |
|
51 |
encoder := something. |
|
52 |
! |
|
53 |
||
54 |
stream |
|
55 |
^ stream |
|
56 |
! |
|
57 |
||
58 |
stream:something |
|
59 |
stream := something. |
|
60 |
! ! |
|
61 |
||
62 |
!EncodedStream methodsFor:'stream protocol'! |
|
63 |
||
8175 | 64 |
atEnd |
65 |
^ stream atEnd |
|
66 |
! |
|
67 |
||
8165 | 68 |
close |
69 |
stream close |
|
70 |
! |
|
71 |
||
8213 | 72 |
cr |
73 |
stream cr |
|
74 |
! |
|
75 |
||
8147 | 76 |
nextChunk |
8175 | 77 |
|chunk| |
78 |
||
79 |
chunk := stream nextChunk. |
|
80 |
chunk isNil ifTrue:[^ chunk]. |
|
81 |
^ encoder decodeString:chunk |
|
8147 | 82 |
! |
83 |
||
8213 | 84 |
nextChunkPut:chunk |
85 |
stream nextChunkPut:(encoder encodeString:chunk) |
|
86 |
! |
|
87 |
||
8047 | 88 |
nextPut:aCharacter |
89 |
self nextPutAll:(aCharacter asString). |
|
90 |
! |
|
91 |
||
92 |
nextPutAll:aCollection |
|
93 |
stream nextPutAll:(encoder encodeString:aCollection). |
|
8147 | 94 |
! |
95 |
||
8444 | 96 |
peek |
97 |
^ stream peek |
|
98 |
! |
|
99 |
||
8175 | 100 |
peekFor:aCharacter |
101 |
^ stream peekFor:aCharacter |
|
102 |
! |
|
103 |
||
8165 | 104 |
position |
105 |
^ stream position |
|
106 |
! |
|
107 |
||
8197 | 108 |
position0Based |
109 |
^ stream position0Based |
|
110 |
! |
|
111 |
||
112 |
position0Based:newPosition |
|
113 |
stream position0Based:newPosition |
|
114 |
! |
|
115 |
||
8175 | 116 |
position1Based |
117 |
^ stream position1Based |
|
118 |
! |
|
119 |
||
8147 | 120 |
position1Based:newPosition |
121 |
stream position1Based:newPosition |
|
8175 | 122 |
! |
123 |
||
8197 | 124 |
position:newPosition |
125 |
stream position:newPosition |
|
126 |
! |
|
127 |
||
8213 | 128 |
setToEnd |
129 |
stream setToEnd |
|
130 |
! |
|
131 |
||
8175 | 132 |
skipSeparators |
133 |
^ stream skipSeparators |
|
8047 | 134 |
! ! |
135 |
||
136 |
!EncodedStream class methodsFor:'documentation'! |
|
137 |
||
138 |
version |
|
8447
9bdea3431846
EncodedStream inherts from PeekableStream
Stefan Vogel <sv@exept.de>
parents:
8444
diff
changeset
|
139 |
^ '$Header: /cvs/stx/stx/libbasic/EncodedStream.st,v 1.9 2004-07-13 13:10:20 stefan Exp $' |
8047 | 140 |
! ! |