Removed methods from FileHandle to make it compilable.
Having methods there is not a good idea anyway.
"{ Package: 'stx:goodies/xtreams/substreams' }"
"{ NameSpace: Xtreams }"
PositionReadSubstream subclass:#LimitReadSubstream
instanceVariableNames:'limit'
classVariableNames:''
poolDictionaries:''
category:'Xtreams-Substreams'
!
LimitReadSubstream comment:'Limits the number of elements that can be read from the source stream.
Instance Variables
limit <Integer> maximum number of elements that can be read from this stream
position <Integer> number of elements already read from the stream
'
!
!LimitReadSubstream class methodsFor:'instance creation'!
on: aSource limit: anInteger
^self new on: aSource limit: anInteger
! !
!LimitReadSubstream methodsFor:'accessing'!
get
position = limit ifTrue: [Incomplete zero raise].
^super get
!
read: anInteger into: aSequenceableCollection at: startIndex
| count |
count := anInteger min: self available.
super read: count into: aSequenceableCollection at: startIndex.
count < anInteger ifTrue: [(Incomplete on: aSequenceableCollection count: count at: startIndex) raise].
^anInteger
! !
!LimitReadSubstream methodsFor:'initialize-release'!
on: aSource limit: anInteger
self on: aSource.
limit := anInteger
!
subseekend
self isPositionable ifFalse: [^self].
self -= 0
! !
!LimitReadSubstream methodsFor:'seeking'!
-= anInteger
| available |
anInteger < 0 ifTrue: [Incomplete zero raise].
available := anInteger min: limit.
source ++ (limit - position - available).
position := limit - available.
available = anInteger ifTrue: [^anInteger].
^(Incomplete count: available) raise
!
length
^limit
! !
!LimitReadSubstream class methodsFor:'documentation'!
version_SVN
^ '$Id$'
! !