Base64Coder.st
changeset 1888 7113378d5a37
parent 1641 f708600ad7d9
child 1964 671b01812775
equal deleted inserted replaced
1887:f26d9b04244d 1888:7113378d5a37
     7  inclusion of the above copyright notice.   This software may not
     7  inclusion of the above copyright notice.   This software may not
     8  be provided or otherwise made available to, or used by, any
     8  be provided or otherwise made available to, or used by, any
     9  other person.  No title to or ownership of the software is
     9  other person.  No title to or ownership of the software is
    10  hereby transferred.
    10  hereby transferred.
    11 "
    11 "
    12 
       
    13 "{ Package: 'stx:libbasic2' }"
    12 "{ Package: 'stx:libbasic2' }"
    14 
    13 
    15 ObjectCoder subclass:#Base64Coder
    14 ObjectCoder subclass:#Base64Coder
    16 	instanceVariableNames:'buffer bits charCount peekByte atEnd lineLimit'
    15 	instanceVariableNames:'buffer bits charCount peekByte atEnd lineLimit'
    17 	classVariableNames:'Base64Mapping Base64ReverseMapping'
    16 	classVariableNames:'Base64Mapping Base64ReverseMapping'
   427     peekByte notNil ifTrue:[
   426     peekByte notNil ifTrue:[
   428         answerStream nextPut:peekByte.
   427         answerStream nextPut:peekByte.
   429         peekByte := nil.
   428         peekByte := nil.
   430     ].
   429     ].
   431     [
   430     [
   432         [bits ~~ 0] whileTrue:[
   431         [bits >= 8] whileTrue:[
   433             answerStream nextPut:((buffer bitShift:(8 - bits)) bitAnd:16rFF).
   432             answerStream nextPut:((buffer bitShift:(8 - bits)) bitAnd:16rFF).
   434             bits := bits - 8.
   433             bits := bits - 8.
   435         ].
   434         ].
   436         self fillBuffer.
   435         self fillBuffer.
   437     ] doWhile:[bits ~~ 0].
   436     ] doWhile:[bits > 0].
   438 
   437 
   439     ^ answerStream contents
   438     ^ answerStream contents
   440 ! !
   439 ! !
   441 
   440 
   442 !Base64Coder class methodsFor:'documentation'!
   441 !Base64Coder class methodsFor:'documentation'!
   443 
   442 
   444 version
   443 version
   445     ^ '$Header: /cvs/stx/stx/libbasic2/Base64Coder.st,v 1.17 2006-06-14 10:06:11 stefan Exp $'
   444     ^ '$Header: /cvs/stx/stx/libbasic2/Base64Coder.st,v 1.18 2007-07-11 14:05:31 cg Exp $'
   446 ! !
   445 ! !
   447 
   446 
   448 Base64Coder initialize!
   447 Base64Coder initialize!