EncodedStream.st
branchjv
changeset 25399 b919356a1d8b
parent 23547 c69c97cec351
equal deleted inserted replaced
25398:b0d020199bd0 25399:b919356a1d8b
     1 "{ Encoding: utf8 }"
       
     2 
       
     3 "
     1 "
     4  COPYRIGHT (c) 2004 by eXept Software AG
     2  COPYRIGHT (c) 2004 by eXept Software AG
     5  COPYRIGHT (c) 2010 Jan Vrany
     3  COPYRIGHT (c) 2010 Jan Vrany
       
     4  COPYRIGHT (c) 2020 LabWare
     6               All Rights Reserved
     5               All Rights Reserved
     7 
     6 
     8  This software is furnished under a license and may be used
     7  This software is furnished under a license and may be used
     9  only in accordance with the terms of that license and with the
     8  only in accordance with the terms of that license and with the
    10  inclusion of the above copyright notice.   This software may not
     9  inclusion of the above copyright notice.   This software may not
    27 
    26 
    28 copyright
    27 copyright
    29 "
    28 "
    30  COPYRIGHT (c) 2004 by eXept Software AG
    29  COPYRIGHT (c) 2004 by eXept Software AG
    31  COPYRIGHT (c) 2010 Jan Vrany
    30  COPYRIGHT (c) 2010 Jan Vrany
       
    31  COPYRIGHT (c) 2020 LabWare
    32               All Rights Reserved
    32               All Rights Reserved
    33 
    33 
    34  This software is furnished under a license and may be used
    34  This software is furnished under a license and may be used
    35  only in accordance with the terms of that license and with the
    35  only in accordance with the terms of that license and with the
    36  inclusion of the above copyright notice.   This software may not
    36  inclusion of the above copyright notice.   This software may not
    55     ^ (self basicNew) stream:streamArg; encoder:encoder
    55     ^ (self basicNew) stream:streamArg; encoder:encoder
    56 
    56 
    57     "
    57     "
    58      |s|
    58      |s|
    59      s := EncodedStream stream:Transcript encoder:(CharacterEncoder encoderToEncodeFrom:#utf8 into:#unicode).
    59      s := EncodedStream stream:Transcript encoder:(CharacterEncoder encoderToEncodeFrom:#utf8 into:#unicode).
    60      s nextPutAll:('öäü' utf8Encoded)
    60      s nextPutAll:('öäü' utf8Encoded)
    61     "
    61     "
    62 !
    62 !
    63 
    63 
    64 stream:streamArg encoding:encodingSymbol
    64 stream:streamArg encoding:encodingSymbol
    65     ^ self stream:streamArg encoder:(CharacterEncoder encoderFor:encodingSymbol)
    65     ^ self stream:streamArg encoder:(CharacterEncoder encoderFor:encodingSymbol)
    66 
    66 
    67     "
    67     "
    68      |baseStream s|
    68      |baseStream s|
    69      baseStream := '' readWriteStream.
    69      baseStream := '' readWriteStream.
    70      s := EncodedStream stream:baseStream encoding:#utf8.
    70      s := EncodedStream stream:baseStream encoding:#utf8.
    71      s nextPutAll:'öäü'.
    71      s nextPutAll:'öäü'.
    72      baseStream reset; contents.
    72      baseStream reset; contents.
    73     "
    73     "
    74 ! !
    74 ! !
    75 
    75 
    76 !EncodedStream class methodsFor:'Compatibility-VW5.4'!
    76 !EncodedStream class methodsFor:'Compatibility-VW5.4'!
   177 
   177 
   178 stream
   178 stream
   179     ^ stream
   179     ^ stream
   180 !
   180 !
   181 
   181 
   182 stream:something
   182 stream:aStream
   183     stream := something.
   183     self assert: aStream isEncodedStream not.
       
   184     stream := aStream.
       
   185 
       
   186     "Modified: / 20-07-2020 / 15:36:54 / Jan Vrany <jan.vrany@labware.com>"
   184 ! !
   187 ! !
   185 
   188 
   186 !EncodedStream methodsFor:'private fileIn'!
   189 !EncodedStream methodsFor:'private fileIn'!
   187 
   190 
   188 basicFileInNotifying:someone passChunk:passChunk
   191 basicFileInNotifying:someone passChunk:passChunk
   604 
   607 
   605 version_CVS
   608 version_CVS
   606     ^ '$Header$'
   609     ^ '$Header$'
   607 !
   610 !
   608 
   611 
       
   612 version_HG
       
   613 
       
   614     ^ '$Changeset: <not expanded> $'
       
   615 !
       
   616 
   609 version_SVN
   617 version_SVN
   610     ^ '$ Id: EncodedStream.st 10643 2011-06-08 21:53:07Z vranyj1  $'
   618     ^ '$ Id: EncodedStream.st 10643 2011-06-08 21:53:07Z vranyj1  $'
   611 ! !
   619 ! !
   612 
   620