The Trunk: Network-nice.67.mcz

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

The Trunk: Network-nice.67.mcz

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

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

Name: Network-nice.67
Author: nice
Time: 28 March 2010, 10:36:49.996 pm
UUID: 64b9fd8e-4cf4-4f47-bce6-d70517a4842c
Ancestors: Network-bp.66

1) fix some _ assignment
2) add Socket support for #next:putAll:startingAt: and #readInto:startingAt:count:
3) do not let ascii/binary resetBuffers gratuitously

=============== Diff against Network-bp.66 ===============

Item was changed:
  ----- Method: SocketStream>>ascii (in category 'configuration') -----
  ascii
  "Tell the SocketStream to send data
  as Strings instead of ByteArrays.
  This is default."
 
  binary := false.
+ inBuffer
+ ifNil: [self resetBuffers]
+ ifNotNil:
+ [inBuffer := inBuffer asString.
+ outBuffer := outBuffer asString]!
- self resetBuffers!

Item was changed:
  ----- Method: SocketStream>>binary (in category 'configuration') -----
  binary
  "Tell the SocketStream to send data
  as ByteArrays instead of Strings.
  Default is ascii."
 
  binary := true.
+ inBuffer
+ ifNil: [self resetBuffers]
+ ifNotNil:
+ [inBuffer := inBuffer asByteArray.
+ outBuffer := outBuffer asByteArray]!
- self resetBuffers!

Item was added:
+ ----- Method: SocketStream>>next:putAll:startingAt: (in category 'stream out') -----
+ next: n putAll: aCollection startingAt: startIndex
+ "Put a String or a ByteArray onto the stream.
+ Currently a large collection will allocate a large buffer.
+ Warning: this does not work with WideString: they have to be converted first."
+
+ self adjustOutBuffer: n.
+ outBuffer replaceFrom: outNextToWrite to: outNextToWrite + n - 1 with: aCollection startingAt: startIndex.
+ outNextToWrite := outNextToWrite + n.
+ self checkFlush.
+ ^aCollection!

Item was added:
+ ----- Method: SocketStream>>readInto:startingAt:count: (in category 'stream in') -----
+ readInto: aCollection startingAt: startIndex count: anInteger
+ "Read n objects into the given collection starting at startIndex.
+ Return number of elements that have been read."
+
+ "Implementation note: This method DOES signal timeout if not
+ enough elements are received. It does NOT signal
+ ConnectionClosed as closing the connection is the only way by
+ which partial data can be read."
+
+ | start amount |
+
+ [self receiveData: anInteger] on: ConnectionClosed do:[:ex| ex return].
+
+ "Inlined version of nextInBuffer: to avoid copying the contents"
+ amount := anInteger min: (inNextToWrite - lastRead - 1).
+ start := lastRead + 1.
+ lastRead := lastRead + amount.
+ aCollection
+ replaceFrom: startIndex
+ to: startIndex + amount-1
+ with: inBuffer
+ startingAt: start.
+ ^amount!

Item was changed:
  ----- Method: ServerDirectory>>oldFileOrNoneNamed: (in category 'file directory') -----
  oldFileOrNoneNamed: fullName
  "If the file exists, answer a read-only RemoteFileStream on it. If it doesn't, answer nil.  fullName is directory path, and does include name of the server.  Or just a simple fileName.  Do prefetch the data."
   
 
  ^ Cursor wait showWhile:
+ [ | file |
+ file := self asServerFileNamed: fullName.
- [ | file |file := self asServerFileNamed: fullName.
  file readOnly.
  "file exists ifFalse: [^ nil]." "on the server"
  file isTypeFile
  ifTrue: [FileStream oldFileOrNoneNamed: (file fileNameRelativeTo: self)]
  ifFalse: [self streamOnBeginningOf: file]]!

Item was changed:
  ----- Method: MailAddressTokenizer class>>initialize (in category 'class initialization') -----
  initialize
  "Initalize class variables using   MailAddressTokenizer initialize"
 
  | atomChars |
 
+ CSParens := CharacterSet empty.
- CSParens _ CharacterSet empty.
  CSParens addAll: '()'.
 
+ CSSpecials := CharacterSet empty.
- CSSpecials _ CharacterSet empty.
  CSSpecials addAll: '()<>@,;:\".[]'.
 
+ CSNonSeparators := CharacterSet separators complement.
- CSNonSeparators _ CharacterSet separators complement.
 
 
  "(from RFC 2822)"
  atomChars := CharacterSet empty.
  atomChars addAll: ($A to: $Z).
  atomChars addAll: ($a to: $z).
  atomChars addAll: ($0 to: $9).
  atomChars addAll: '!!#$%^''*+-/=?^_`{|}~'.
 
  CSNonAtom :=  atomChars complement.!