On Mon, Feb 20, 2012 at 4:53 PM, Stéphane Ducasse <[email protected] > wrote:
> camillo > > I'm trying your script with the latest image. > > > | f files| > f := FSFilesystem disk workingDirectory / 'www.squeaksource.com' / > 'Kozen'. > files := f glob: [ :each| each basename endsWith: '.mcz']. > > files do: [ :file ||entity stream| > stream := file readStream. > (entity := ZnStreamingEntity type: ZnMimeType > applicationOctetStream) > stream: stream; > contentLength: stream size. > Transcript show: file; cr. > "upload the version to gemstone" > ZnClient new > systemPolicy; > beOneShot; > signalProgress: true; > ifFail: [ :exception | Transcript show: file basename; > show: ' '; print: exception ]; > username: 'sd' password: 'sn00py_'; > entity: entity; > url: ( 'http://ss3.gemstone.com/ss/Kozen/', file basename); > put ] > displayingProgress: 'Uploading mcz' > > > apparently FSReadStream does not know isBinary > > All FS streams do not understand #isBinary nor #binary since they are always binary. > > > streamFrom: inputStream to: outputStream size: totalSize > | bufferSize buffer leftToRead | > bufferSize := 4096 min: totalSize. > buffer := (inputStream isBinary ifTrue: [ ByteArray ] ifFalse: [ > String ]) new: bufferSize. > ^^^^^^^^^^ > leftToRead := totalSize. > [ leftToRead > 0 ] > whileTrue: [ | readCount | > readCount := bufferSize min: leftToRead. > inputStream next: readCount into: buffer. > leftToRead := leftToRead - readCount. > outputStream next: readCount putAll: buffer > startingAt: 1 ] > -- Mariano http://marianopeck.wordpress.com
