The Trunk: Compression-ar.22.mcz

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

The Trunk: Compression-ar.22.mcz

commits-2
Andreas Raab uploaded a new version of Compression to project The Trunk:
http://source.squeak.org/trunk/Compression-ar.22.mcz

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

Name: Compression-ar.22
Author: ar
Time: 5 September 2010, 10:53:14.026 am
UUID: 579fde37-ea30-f14a-9799-a08eb7eac29f
Ancestors: Compression-ar.21

Restructurings to reduce package depencencies.

=============== Diff against Compression-ar.21 ===============

Item was changed:
  ----- Method: GZipWriteStream class>>initialize (in category 'class initialization') -----
  initialize
+ FileServices registerFileReader: self!
- FileList registerFileReader: self!

Item was added:
+ ----- Method: StandardFileStream>>compressFile (in category '*Compression') -----
+ compressFile
+ "Write a new file that has the data in me compressed in GZip format."
+ | zipped buffer |
+
+ self readOnly; binary.
+ zipped := self directory newFileNamed: (self name, FileDirectory dot, 'gz').
+ zipped binary; setFileTypeToObject.
+ "Type and Creator not to be text, so can be enclosed in an email"
+ zipped := GZipWriteStream on: zipped.
+ buffer := ByteArray new: 50000.
+ 'Compressing ', self fullName displayProgressAt: Sensor cursorPoint
+ from: 0 to: self size
+ during: [:bar |
+ [self atEnd] whileFalse: [
+ bar value: self position.
+ zipped nextPutAll: (self nextInto: buffer)].
+ zipped close.
+ self close].
+ ^zipped!

Item was changed:
  ----- Method: GZipWriteStream class>>unload (in category 'class initialization') -----
  unload
+ FileServices unregisterFileReader: self!
- FileList unregisterFileReader: self!

Item was added:
+ ----- Method: FileStream>>viewGZipContents (in category '*Compression') -----
+ viewGZipContents
+ "View the contents of a gzipped file"
+
+ | stringContents |
+ self binary.
+ stringContents := self contentsOfEntireFile.
+ stringContents := Cursor wait showWhile: [(GZipReadStream on: stringContents) upToEnd].
+ stringContents := stringContents asString withSqueakLineEndings.
+
+ UIManager default
+ edit: stringContents;
+ label: 'Decompressed contents of: ', self localName!

Item was changed:
  ----- Method: GZipReadStream class>>unload (in category 'class initialization') -----
  unload
 
+ FileServices unregisterFileReader: self !
- FileList unregisterFileReader: self !


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Compression-ar.22.mcz

Nicolas Cellier
Shouldn't this package include #lastIndexOfPKSignature: ?
I think that already happened in Pharo

cheers

Nicolas

2010/9/5  <[hidden email]>:

> Andreas Raab uploaded a new version of Compression to project The Trunk:
> http://source.squeak.org/trunk/Compression-ar.22.mcz
>
> ==================== Summary ====================
>
> Name: Compression-ar.22
> Author: ar
> Time: 5 September 2010, 10:53:14.026 am
> UUID: 579fde37-ea30-f14a-9799-a08eb7eac29f
> Ancestors: Compression-ar.21
>
> Restructurings to reduce package depencencies.
>
> =============== Diff against Compression-ar.21 ===============
>
> Item was changed:
>  ----- Method: GZipWriteStream class>>initialize (in category 'class initialization') -----
>  initialize
> +       FileServices registerFileReader: self!
> -       FileList registerFileReader: self!
>
> Item was added:
> + ----- Method: StandardFileStream>>compressFile (in category '*Compression') -----
> + compressFile
> +       "Write a new file that has the data in me compressed in GZip format."
> +       | zipped buffer |
> +
> +       self readOnly; binary.
> +       zipped := self directory newFileNamed: (self name, FileDirectory dot, 'gz').
> +       zipped binary; setFileTypeToObject.
> +               "Type and Creator not to be text, so can be enclosed in an email"
> +       zipped := GZipWriteStream on: zipped.
> +       buffer := ByteArray new: 50000.
> +       'Compressing ', self fullName displayProgressAt: Sensor cursorPoint
> +               from: 0 to: self size
> +               during: [:bar |
> +                       [self atEnd] whileFalse: [
> +                               bar value: self position.
> +                               zipped nextPutAll: (self nextInto: buffer)].
> +                       zipped close.
> +                       self close].
> +       ^zipped!
>
> Item was changed:
>  ----- Method: GZipWriteStream class>>unload (in category 'class initialization') -----
>  unload
> +       FileServices unregisterFileReader: self!
> -       FileList unregisterFileReader: self!
>
> Item was added:
> + ----- Method: FileStream>>viewGZipContents (in category '*Compression') -----
> + viewGZipContents
> +       "View the contents of a gzipped file"
> +
> +       | stringContents |
> +       self binary.
> +       stringContents := self contentsOfEntireFile.
> +       stringContents := Cursor wait showWhile: [(GZipReadStream on: stringContents) upToEnd].
> +       stringContents := stringContents asString withSqueakLineEndings.
> +
> +       UIManager default
> +               edit: stringContents;
> +               label: 'Decompressed contents of: ', self localName!
>
> Item was changed:
>  ----- Method: GZipReadStream class>>unload (in category 'class initialization') -----
>  unload
>
> +       FileServices unregisterFileReader: self !
> -       FileList unregisterFileReader: self !
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Compression-ar.22.mcz

Andreas.Raab
On 9/6/2010 2:49 PM, Nicolas Cellier wrote:
> Shouldn't this package include #lastIndexOfPKSignature: ?

For sure. Although it's not in my current focus. What I'm rather trying
to do is to learn to understand the "hard" dependencies between the
packages and remove or reduce them wherever possible. If you fire up the
depency browser, you can see that between the Collections, Compiler,
Exceptions, Files, Graphics, Kernel, Multilingual, and System package
there is a fairly small kernel somewhere. There are few external
references left; the biggest issues at this point is how to deal with
the System package (and Utilities/Preferences in particular) since those
are by far the largest holders of dependencies to Morphic, Tools and the
rest.

Cheers,
   - Andreas


> I think that already happened in Pharo
>
> cheers
>
> Nicolas
>
> 2010/9/5<[hidden email]>:
>> Andreas Raab uploaded a new version of Compression to project The Trunk:
>> http://source.squeak.org/trunk/Compression-ar.22.mcz
>>
>> ==================== Summary ====================
>>
>> Name: Compression-ar.22
>> Author: ar
>> Time: 5 September 2010, 10:53:14.026 am
>> UUID: 579fde37-ea30-f14a-9799-a08eb7eac29f
>> Ancestors: Compression-ar.21
>>
>> Restructurings to reduce package depencencies.
>>
>> =============== Diff against Compression-ar.21 ===============
>>
>> Item was changed:
>>   ----- Method: GZipWriteStream class>>initialize (in category 'class initialization') -----
>>   initialize
>> +       FileServices registerFileReader: self!
>> -       FileList registerFileReader: self!
>>
>> Item was added:
>> + ----- Method: StandardFileStream>>compressFile (in category '*Compression') -----
>> + compressFile
>> +       "Write a new file that has the data in me compressed in GZip format."
>> +       | zipped buffer |
>> +
>> +       self readOnly; binary.
>> +       zipped := self directory newFileNamed: (self name, FileDirectory dot, 'gz').
>> +       zipped binary; setFileTypeToObject.
>> +               "Type and Creator not to be text, so can be enclosed in an email"
>> +       zipped := GZipWriteStream on: zipped.
>> +       buffer := ByteArray new: 50000.
>> +       'Compressing ', self fullName displayProgressAt: Sensor cursorPoint
>> +               from: 0 to: self size
>> +               during: [:bar |
>> +                       [self atEnd] whileFalse: [
>> +                               bar value: self position.
>> +                               zipped nextPutAll: (self nextInto: buffer)].
>> +                       zipped close.
>> +                       self close].
>> +       ^zipped!
>>
>> Item was changed:
>>   ----- Method: GZipWriteStream class>>unload (in category 'class initialization') -----
>>   unload
>> +       FileServices unregisterFileReader: self!
>> -       FileList unregisterFileReader: self!
>>
>> Item was added:
>> + ----- Method: FileStream>>viewGZipContents (in category '*Compression') -----
>> + viewGZipContents
>> +       "View the contents of a gzipped file"
>> +
>> +       | stringContents |
>> +       self binary.
>> +       stringContents := self contentsOfEntireFile.
>> +       stringContents := Cursor wait showWhile: [(GZipReadStream on: stringContents) upToEnd].
>> +       stringContents := stringContents asString withSqueakLineEndings.
>> +
>> +       UIManager default
>> +               edit: stringContents;
>> +               label: 'Decompressed contents of: ', self localName!
>>
>> Item was changed:
>>   ----- Method: GZipReadStream class>>unload (in category 'class initialization') -----
>>   unload
>>
>> +       FileServices unregisterFileReader: self !
>> -       FileList unregisterFileReader: self !
>>
>>
>>
>
>