UninterpretedBytes.st
changeset 12951 6856ade56f18
parent 12769 435668a20ddd
child 13575 44a3b3c29795
--- a/UninterpretedBytes.st	Sun Jul 18 23:16:19 2010 +0200
+++ b/UninterpretedBytes.st	Mon Jul 19 15:58:34 2010 +0200
@@ -2434,6 +2434,22 @@
     "Created: 9.9.1996 / 15:28:34 / cg"
 ! !
 
+!UninterpretedBytes methodsFor:'converting'!
+
+asExternalBytes
+    |sz bytes|
+
+    sz := self size.
+    bytes := ExternalBytes unprotectedNew:sz.
+    bytes replaceBytesFrom:1 to:sz with:self startingAt:1.
+    ^ bytes
+
+    "
+      #[1 2 3 4 5 6 7] asExternalBytes
+      'Hello World' asExternalBytes
+    "
+! !
+
 !UninterpretedBytes methodsFor:'filling & replacing'!
 
 replaceBytesFrom:start to:stop with:aCollection startingAt:repStart
@@ -2886,9 +2902,9 @@
 !UninterpretedBytes class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/UninterpretedBytes.st,v 1.76 2010-03-08 07:42:57 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/UninterpretedBytes.st,v 1.77 2010-07-19 13:58:34 stefan Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/UninterpretedBytes.st,v 1.76 2010-03-08 07:42:57 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/UninterpretedBytes.st,v 1.77 2010-07-19 13:58:34 stefan Exp $'
 ! !