236 "append a newline to the stream. |
236 "append a newline to the stream. |
237 This is only allowed, if the receiver supports writing." |
237 This is only allowed, if the receiver supports writing." |
238 |
238 |
239 self nextPut:(Character nl) |
239 self nextPut:(Character nl) |
240 ! ! |
240 ! ! |
241 |
|
242 |
241 |
243 !Stream methodsFor:'accessing'! |
242 !Stream methodsFor:'accessing'! |
244 |
243 |
245 contents |
244 contents |
246 "return the entire contents of the stream. |
245 "return the entire contents of the stream. |
952 "Modified: 22.4.1997 / 10:43:08 / cg" |
951 "Modified: 22.4.1997 / 10:43:08 / cg" |
953 ! |
952 ! |
954 |
953 |
955 nextBytes:numBytes into:aCollection startingAt:initialIndex blockSize:blockSize |
954 nextBytes:numBytes into:aCollection startingAt:initialIndex blockSize:blockSize |
956 "like nextBytes:into:startingAt:, but read in blocks of the given size. |
955 "like nextBytes:into:startingAt:, but read in blocks of the given size. |
957 This leads to better beahvior when reading large chunks from a slow device, |
956 This leads to better behavior when reading large chunks from a slow device, |
958 such as a cdrom drive (since a single unix-read is not interruptable)." |
957 such as a cdrom drive (since a single unix-read is not interruptable)." |
959 |
958 |
960 |nR oR n| |
959 |nR oR n| |
961 |
960 |
962 nR := numBytes. |
961 nR := numBytes. |
963 oR := initialIndex. |
962 oR := initialIndex. |
964 [nR > 0] whileTrue:[ |
963 [nR > 0] whileTrue:[ |
965 n := nR. |
964 n := nR. |
966 n > blockSize ifTrue:[n := blockSize]. |
965 n > blockSize ifTrue:[n := blockSize]. |
967 n := self nextBytes:n into:aCollection startingAt:oR. |
966 n := self nextBytes:n into:aCollection startingAt:oR. |
968 n == 0 ifTrue:[ |
967 n == 0 ifTrue:[ |
969 ^ numBytes - nR |
968 ^ numBytes - nR |
970 ]. |
969 ]. |
971 oR := oR + n. |
970 oR := oR + n. |
972 nR := nR - n |
971 nR := nR - n |
973 ]. |
972 ]. |
974 ^ numBytes |
973 ^ numBytes |
975 |
974 |
976 "Created: 24.4.1997 / 21:09:34 / cg" |
975 "Created: / 24-04-1997 / 21:09:34 / cg" |
977 "Modified: 24.4.1997 / 21:19:50 / cg" |
976 "Modified (comment): / 25-08-2017 / 00:17:09 / cg" |
978 ! |
977 ! |
979 |
978 |
980 nextBytesInto:anObject |
979 nextBytesInto:anObject |
981 "read bytes into an object, regardless of binary/text mode. |
980 "read bytes into an object, regardless of binary/text mode. |
982 The number of bytes to read is defined by the object's size. |
981 The number of bytes to read is defined by the object's size. |