FileApplicationNoteBook.st
changeset 5718 a16c274a18ef
parent 5717 f2ec29a73239
child 5737 c5a659e2c4c7
equal deleted inserted replaced
5717:f2ec29a73239 5718:a16c274a18ef
  4342      The files lines are delimited by aCharacter.
  4342      The files lines are delimited by aCharacter.
  4343      If encoding is nonNil, the file is assumed to be coded according to
  4343      If encoding is nonNil, the file is assumed to be coded according to
  4344      that symbol, and #decodeString: should be able to convert it into unicode.
  4344      that symbol, and #decodeString: should be able to convert it into unicode.
  4345      Always returns a unicode string."
  4345      Always returns a unicode string."
  4346 
  4346 
  4347     |text line fileEncoding encoder firstDecoderError|
  4347     |text line fileEncoding decoder firstDecoderError|
  4348 
  4348 
  4349     fileEncoding := fileEncodingArg ? #'iso8859-1'.
  4349     fileEncoding := fileEncodingArg ? #'iso8859-1'.
  4350     encoder := CharacterEncoder encoderToEncodeFrom:fileEncoding into:#'unicode'.
  4350     decoder := CharacterEncoder encoderFor:fileEncoding.
  4351 
  4351 
  4352     text := StringCollection new.
  4352     text := StringCollection new.
  4353 
  4353 
  4354     firstDecoderError := true.
  4354     firstDecoderError := true.
  4355 
  4355 
  4378                 partialLine := ex parameter at:2.
  4378                 partialLine := ex parameter at:2.
  4379                 ex proceedWith:(partialLine , s upTo:aCharacter)
  4379                 ex proceedWith:(partialLine , s upTo:aCharacter)
  4380             ] do:[
  4380             ] do:[
  4381                 [aStream atEnd] whileFalse:[
  4381                 [aStream atEnd] whileFalse:[
  4382                     line := aStream nextLine withTabsExpanded.
  4382                     line := aStream nextLine withTabsExpanded.
  4383                     text add:(encoder encodeString:line)
  4383                     text add:(decoder decodeString:line)
  4384                 ].
  4384                 ].
  4385             ].
  4385             ].
  4386         ] ifFalse:[
  4386         ] ifFalse:[
  4387             [aStream atEnd] whileFalse:[
  4387             [aStream atEnd] whileFalse:[
  4388                 line := (aStream upTo:aCharacter) withTabsExpanded.
  4388                 line := (aStream upTo:aCharacter) withTabsExpanded.
  4389                 text add:(encoder encodeString:line)
  4389                 text add:(decoder decodeString:line)
  4390             ].
  4390             ].
  4391         ].
  4391         ].
  4392     ].
  4392     ].
  4393     ^ text
  4393     ^ text
  4394 !
  4394 !
  5455 ! !
  5455 ! !
  5456 
  5456 
  5457 !FileApplicationNoteBook class methodsFor:'documentation'!
  5457 !FileApplicationNoteBook class methodsFor:'documentation'!
  5458 
  5458 
  5459 version
  5459 version
  5460     ^ '$Header: /cvs/stx/stx/libtool/FileApplicationNoteBook.st,v 1.163 2004-03-15 12:05:14 penk Exp $'
  5460     ^ '$Header: /cvs/stx/stx/libtool/FileApplicationNoteBook.st,v 1.164 2004-03-15 12:59:21 ca Exp $'
  5461 ! !
  5461 ! !