EncodedStream.st
author penk
Tue, 03 Aug 2004 22:07:01 +0200
changeset 8459 1f59b17291a3
parent 8447 9bdea3431846
child 8712 bcef3a0c0a1d
permissions -rw-r--r--
*** empty log message ***

"
 COPYRIGHT (c) 2004 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"

"{ Package: 'stx:libbasic' }"

PeekableStream subclass:#EncodedStream
	instanceVariableNames:'encoder stream'
	classVariableNames:''
	poolDictionaries:''
	category:'Collections-Text-Encodings'
!

!EncodedStream class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 2004 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
! !

!EncodedStream class methodsFor:'instance creation'!

stream:streamArg encoder:encoder
    ^ (self basicNew) stream:streamArg; encoder:encoder
! !

!EncodedStream methodsFor:'accessing'!

encoder
    ^ encoder
!

encoder:something
    encoder := something.
!

stream
    ^ stream
!

stream:something
    stream := something.
! !

!EncodedStream methodsFor:'stream protocol'!

atEnd
    ^ stream atEnd
!

close
    stream close
!

cr
    self nextPutAll:(Character cr asString)
!

nextChunk
    |chunk|

    chunk := stream nextChunk.
    chunk isNil ifTrue:[^ chunk].
    ^ encoder decodeString:chunk
!

nextChunkPut:chunk
    stream nextChunkPut:(encoder encodeString:chunk)
!

nextPut:aCharacter
    self nextPutAll:(aCharacter asString).
!

nextPutAll:aCollection
    stream nextPutAll:(encoder encodeString:aCollection).
!

peek
    ^ stream peek
!

peekFor:aCharacter
    ^ stream peekFor:aCharacter
!

position
    ^ stream position
!

position0Based
    ^ stream position0Based
!

position0Based:newPosition
    stream position0Based:newPosition
!

position1Based
    ^ stream position1Based
!

position1Based:newPosition
    stream position1Based:newPosition
!

position:newPosition
    stream position:newPosition
!

setToEnd
    stream setToEnd
!

skipSeparators
    ^ stream skipSeparators
! !

!EncodedStream class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libbasic/EncodedStream.st,v 1.10 2004-08-03 20:07:01 penk Exp $'
! !