Stream.st
changeset 20305 e61e2ce6a6f5
parent 20254 5b84a00d217b
child 20344 152b525b5c63
child 20366 5c949545fd4a
equal deleted inserted replaced
20304:22b0d538c95c 20305:e61e2ce6a6f5
       
     1 "{ Encoding: utf8 }"
       
     2 
     1 "
     3 "
     2  COPYRIGHT (c) 1989 by Claus Gittinger
     4  COPYRIGHT (c) 1989 by Claus Gittinger
     3 	      All Rights Reserved
     5 	      All Rights Reserved
     4 
     6 
     5  This software is furnished under a license and may be used
     7  This software is furnished under a license and may be used
   221 
   223 
   222     "/ someObject printOn:self.
   224     "/ someObject printOn:self.
   223     self nextPutAll: someObject asString.
   225     self nextPutAll: someObject asString.
   224 ! !
   226 ! !
   225 
   227 
       
   228 
       
   229 !Stream methodsFor:'Compatibility-VW'!
       
   230 
       
   231 nl
       
   232     "append a newline to the stream.
       
   233      This is only allowed, if the receiver supports writing."
       
   234 
       
   235     self nextPut:(Character nl)
       
   236 ! !
   226 
   237 
   227 
   238 
   228 !Stream methodsFor:'accessing'!
   239 !Stream methodsFor:'accessing'!
   229 
   240 
   230 contents
   241 contents
  2014         self nextPutUtf16Bytes:(aString at:idx) MSB:msb.
  2025         self nextPutUtf16Bytes:(aString at:idx) MSB:msb.
  2015     ].
  2026     ].
  2016 
  2027 
  2017     "
  2028     "
  2018         (#[] writeStream
  2029         (#[] writeStream
  2019             nextPutAllUtf16Bytes:'BÄxxx' MSB:true;
  2030             nextPutAllUtf16Bytes:'BÄxxx' MSB:true;
  2020             nextPutUtf16:(Character codePoint:16r10CCCC) MSB:true;
  2031             nextPutUtf16:(Character codePoint:16r10CCCC) MSB:true;
  2021             contents)
  2032             contents)
  2022    "
  2033    "
  2023 !
  2034 !
  2024 
  2035 
  2432     ]].
  2443     ]].
  2433 
  2444 
  2434     "
  2445     "
  2435         ((WriteStream on:Unicode16String new)
  2446         ((WriteStream on:Unicode16String new)
  2436             nextPutUtf16:$B;
  2447             nextPutUtf16:$B;
  2437             nextPutUtf16:$Ä; 
  2448             nextPutUtf16:$Ä; 
  2438             nextPutUtf16:(Character codePoint:16r10CCCC)
  2449             nextPutUtf16:(Character codePoint:16r10CCCC)
  2439             yourself) contents
  2450             yourself) contents
  2440     "
  2451     "
  2441 !
  2452 !
  2442 
  2453 
  2467             ].
  2478             ].
  2468 
  2479 
  2469     "
  2480     "
  2470         (#[] writeStream
  2481         (#[] writeStream
  2471             nextPutUtf16:$B MSB:true;
  2482             nextPutUtf16:$B MSB:true;
  2472             nextPutUtf16:$Ä MSB:true;
  2483             nextPutUtf16:$Ä MSB:true;
  2473             nextPutUtf16:(Character codePoint:16r10CCCC) MSB:true;
  2484             nextPutUtf16:(Character codePoint:16r10CCCC) MSB:true;
  2474             contents)
  2485             contents)
  2475 
  2486 
  2476         (FileStream newTemporary
  2487         (FileStream newTemporary
  2477             nextPutUtf16:$B MSB:false;
  2488             nextPutUtf16:$B MSB:false;
  2478             nextPutUtf16:$Ä MSB:false;
  2489             nextPutUtf16:$Ä MSB:false;
  2479             nextPutUtf16:(Character codePoint:16r10CCCC) MSB:false;
  2490             nextPutUtf16:(Character codePoint:16r10CCCC) MSB:false;
  2480             reset;
  2491             reset;
  2481             binary;
  2492             binary;
  2482             contents)"
  2493             contents)"
  2483 !
  2494 !
  2538     EncodingError raiseWith:aCharacter errorString:'codePoint > 31bit in #nextPutUtf8:'.
  2549     EncodingError raiseWith:aCharacter errorString:'codePoint > 31bit in #nextPutUtf8:'.
  2539 
  2550 
  2540     "
  2551     "
  2541       (String streamContents:[:s|
  2552       (String streamContents:[:s|
  2542             s nextPutUtf8:$a.
  2553             s nextPutUtf8:$a.
  2543             s nextPutUtf8:$ü.
  2554             s nextPutUtf8:$ü.
  2544             s nextPutUtf8: (Character value:16r1fff).
  2555             s nextPutUtf8: (Character value:16r1fff).
  2545             s nextPutUtf8: (Character value:16rffff).
  2556             s nextPutUtf8: (Character value:16rffff).
  2546             s nextPutUtf8: (Character value:16r1ffffff).
  2557             s nextPutUtf8: (Character value:16r1ffffff).
  2547             s nextPutUtf8: (Character value:16r800).
  2558             s nextPutUtf8: (Character value:16r800).
  2548       ])
  2559       ])