The Trunk: Collections-nice.577.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Collections-nice.577.mcz

commits-2
Nicolas Cellier uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-nice.577.mcz

==================== Summary ====================

Name: Collections-nice.577
Author: nice
Time: 26 July 2014, 11:34:56.071 pm
UUID: c5925cce-0dac-4744-9c8e-08888f259f63
Ancestors: Collections-nice.576

Convert Base64MimeConverter implementation from ReadWriteStream to alternate WriteStream/ReadStream.
Beware, the main class messages now answer a ReadStream, not a ReadWriteStream.

=============== Diff against Collections-nice.576 ===============

Item was changed:
  ----- Method: Base64MimeConverter class>>encodeInteger: (in category 'as yet unclassified') -----
  encodeInteger: int
  | strm |
  "Encode an integer of any length and return the MIME string"
 
+ strm := WriteStream on: (ByteArray new: int digitLength).
- strm := ReadWriteStream on: (ByteArray new: int digitLength).
  1 to: int digitLength do: [:ii | strm nextPut: (int digitAt: ii)].
+ ^ ((self mimeEncode: strm readStream) contents) copyUpTo: $= "remove padding"!
- strm reset.
- ^ ((self mimeEncode: strm) contents) copyUpTo: $= "remove padding"!

Item was changed:
  ----- Method: Base64MimeConverter class>>mimeDecodeToBytes: (in category 'as yet unclassified') -----
  mimeDecodeToBytes: aStream
+ "Return a ReadStream of the original ByteArray.  aStream has only 65 innocuous character values.  aStream is not binary.  (See class comment). 4 bytes in aStream goes to 3 bytes in output."
- "Return a RWBinaryOrTextStream of the original ByteArray.  aStream has only 65 innocuous character values.  aStream is not binary.  (See class comment). 4 bytes in aStream goes to 3 bytes in output."
 
  | me |
  aStream position: 0.
  me := self new mimeStream: aStream.
+ me dataStream: (WriteStream on: (ByteArray new: aStream size * 3 // 4)).
- me dataStream: (RWBinaryOrTextStream on: (ByteArray new: aStream size * 3 // 4)).
  me mimeDecodeToByteArray.
+ ^ me dataStream readStream!
- me dataStream position: 0.
- ^ me dataStream!

Item was changed:
  ----- Method: Base64MimeConverter class>>mimeDecodeToChars: (in category 'as yet unclassified') -----
  mimeDecodeToChars: aStream
  "Return a ReadWriteStream of the original String.  aStream has only 65 innocuous character values.  It is not binary.  (See class comment). 4 bytes in aStream goes to 3 bytes in output."
 
  | me |
  aStream position: 0.
  me := self new mimeStream: aStream.
+ me dataStream: (WriteStream on: (String new: aStream size * 3 // 4)).
- me dataStream: (ReadWriteStream on: (String new: aStream size * 3 // 4)).
  me mimeDecode.
+ ^ me dataStream readStream!
- me dataStream position: 0.
- ^ me dataStream!

Item was changed:
  ----- Method: Base64MimeConverter class>>mimeEncode:multiLine:atStart: (in category 'as yet unclassified') -----
  mimeEncode: aStream multiLine: aBool atStart: resetInput
+ "Return a ReadStream of characters.  The data of aStream is encoded as 65 innocuous characters.  (See class comment). 3 bytes in aStream goes to 4 bytes in output."
- "Return a ReadWriteStream of characters.  The data of aStream is encoded as 65 innocuous characters.  (See class comment). 3 bytes in aStream goes to 4 bytes in output."
 
  | me |
  resetInput ifTrue:[aStream position: 0].
  me := self new dataStream: aStream.
  me multiLine: aBool.
+ me mimeStream: (WriteStream on: (String new: aStream size + 20 * 4 // 3)).
- me mimeStream: (ReadWriteStream on: (String new: aStream size + 20 * 4 // 3)).
  me mimeEncode.
+ ^ me mimeStream readStream!
- me mimeStream position: 0.
- ^ me mimeStream!