class: ReadStream
authorStefan Vogel <sv@exept.de>
Thu, 12 Mar 2015 20:25:11 +0100
changeset 17612 368b5e4da6c9
parent 17611 a3d9a43a6197
child 17613 e3524b50162f
class: ReadStream removed: #copyToEndInto:bufferSize: #nextBytes:into:startingAt:
ReadStream.st
--- a/ReadStream.st	Thu Mar 12 20:24:30 2015 +0100
+++ b/ReadStream.st	Thu Mar 12 20:25:11 2015 +0100
@@ -148,35 +148,6 @@
     "Modified: 15.5.1996 / 17:30:33 / cg"
 ! !
 
-!ReadStream methodsFor:'misc functions'!
-
-copyToEndInto:aWriteStream bufferSize:bufferSize
-    "read from the receiver, and write all data up to the end to another stream.
-     Return the number of bytes which have been transferred.
-     Redefined here to avoid intermediate buffers/garbage.
-     bufferSize does not matter here."
-
-    |cnt|
-
-    collection notNil ifTrue:[
-        aWriteStream nextPutAll:collection startingAt:position+1 to:readLimit.
-        cnt := readLimit - position.
-        position := readLimit.
-        ^ cnt.
-    ].
-    ^ super copyToEndInto:aWriteStream bufferSize:bufferSize.
-
-    "
-     |rs ws|
-
-     ws := #() writeStream.
-     rs := #( 1 2 3 4 ) readStream.
-     rs next.
-     rs copyToEndInto:ws bufferSize:0.
-     ws contents.
-    "
-! !
-
 !ReadStream methodsFor:'queries'!
 
 collectionSize
@@ -462,44 +433,6 @@
     ^ ret
 !
 
-nextBytes:numBytes into:aCollection startingAt:initialIndex
-    "return the next numBytes from the stream. If the end is
-     reached before, only that many bytes are copyied into the
-     collection.
-     Returns the number of bytes that have been actually read.
-     The receiver must support reading of binary bytes.
-
-     Notice: this method is provided here for protocol completeness
-	     with externalStreams - it is normally not used with other
-	     streams."
-
-    ((initialIndex + numBytes - 1) <= aCollection size
-	and:[(position + numBytes) <= readLimit
-	and:[collection isByteCollection
-	and:[aCollection isByteCollection
-    ]]]) ifTrue:[
-	"do it the fast way"
-	aCollection
-	    replaceBytesFrom:initialIndex to:(initialIndex + numBytes - 1)
-	    with:collection startingAt:position+1.
-	position := position + numBytes.
-	^ numBytes
-    ].
-    "do it the hard way"
-    ^ super nextBytes:numBytes into:aCollection startingAt:initialIndex
-
-    "
-     |s n buffer|
-
-     buffer := ByteArray new:10.
-
-     s := ReadStream on:#[1 2 3 4 5 6 7 8 9].
-     s next:3.
-     n := s nextBytes:9 into:buffer startingAt:1.
-     Transcript showCR:('n = %1; buffer = <%2>' bindWith:n with:buffer)
-    "
-!
-
 nextDecimalInteger
     "read the next integer in radix 10.
      Does NOT skip initial whitespace.
@@ -980,10 +913,10 @@
 !ReadStream class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ReadStream.st,v 1.80 2015-03-12 17:10:39 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ReadStream.st,v 1.81 2015-03-12 19:25:11 stefan Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/ReadStream.st,v 1.80 2015-03-12 17:10:39 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ReadStream.st,v 1.81 2015-03-12 19:25:11 stefan Exp $'
 ! !