UninterpretedBytes.st
branchjv
changeset 17910 8d796ca8bd1d
parent 17892 d86c8bd5ece3
child 17911 a99f15c5efa5
--- a/UninterpretedBytes.st	Fri Jan 06 08:53:28 2012 +0000
+++ b/UninterpretedBytes.st	Thu Jan 19 10:06:02 2012 +0000
@@ -2687,6 +2687,27 @@
     "Modified: / 27.7.1998 / 16:58:38 / cg"
 !
 
+replaceBytesWith:replacementCollection
+    "replace elements from another collection, which must be byte-array-like.
+     Replace stops at whichever collection is smaller.
+
+     Notice: This operation modifies the receiver, NOT a copy;
+     therefore the change may affect all others referencing the receiver."
+
+    ^ self
+        replaceBytesFrom:1
+        to:(replacementCollection size min:self size)
+        with:replacementCollection
+        startingAt:1
+
+    "
+     (ByteArray new:10) replaceBytesWith:'hello'    
+     (ByteArray new:10) replaceBytesWith:'hello world bla bla bla'    
+    "
+
+    "Created: / 09-01-2012 / 16:18:10 / cg"
+!
+
 replaceFrom:startIndex to:stopIndex with:aCollection startingAt:repStartIndex
     "replace elements in the receiver between index start and stop,
      with elements  taken from replacementCollection starting at repStart.
@@ -2911,14 +2932,15 @@
 !UninterpretedBytes class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/UninterpretedBytes.st,v 1.80 2011/09/26 09:58:22 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/UninterpretedBytes.st,v 1.81 2012/01/09 15:19:32 cg Exp $'
 !
 
 version_CVS
-    ^ '§Header: /cvs/stx/stx/libbasic/UninterpretedBytes.st,v 1.80 2011/09/26 09:58:22 cg Exp §'
+    ^ 'Header: /cvs/stx/stx/libbasic/UninterpretedBytes.st,v 1.81 2012/01/09 15:19:32 cg Exp '
 !
 
 version_SVN
-    ^ '$Id: UninterpretedBytes.st 10729 2011-10-31 22:19:21Z vranyj1 $'
+    ^ '$Id: UninterpretedBytes.st 10758 2012-01-19 10:06:02Z vranyj1 $'
 ! !
 
+