eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'BitStream':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: BitStream


Inheritance:

   Object
   |
   +--Stream
      |
      +--BitStream

Package:
stx:libbasic2
Category:
Streams-Misc
Version:
rev: 1.5 date: 2023/08/24 12:46:07
user: cg
file: BitStream.st directory: libbasic2
module: stx stc-classLibrary: libbasic2

Description:


a quick and dirty hack (unfinished and not optimized)

[usage:]
    |bs|
    
    bs := BitStream on:(#[2r10000000 2r11000000 2r11100000 2r11110000 2r00001000 2r00000100 2r00000010 2r00000001] readStream).
    ' 10000000 11000000 11100000 11 11000000 00100000 00010000 00001000 000001 '.
    self assert: ( t := bs nextBits:24 MSB:true ) == 2r100000001100000011100000.
    self assert: ( t := bs nextBits:2 MSB:true ) == 2r11.
    self assert: ( t := bs nextBits:24 MSB:true ) == 2r110000000010000000010000.
    self assert: ( t := bs nextBits:8 MSB:true ) == 2r00001000.
    self assert: ( t := bs nextBits:6 MSB:true ) == 2r000001.

    bs reset.
    self assert: ( t := bs nextBits:24 MSB:false ) == 2r000001110000001100000001.
    self assert: ( t := bs nextBits:2 MSB:false ) == 2r11.
    self assert: ( t := bs nextBits:24 MSB:false ) == 2r000010000000010000000011.
    self assert: ( t := bs nextBits:8 MSB:false ) == 2r00010000.
    self assert: ( t := bs nextBits:6 MSB:false ) == 2r100000.

copyright

COPYRIGHT (c) 2023 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.

Class protocol:

instance creation
o  on: aByteStream


Instance protocol:

accessing
o  byteStream: aStream

positioning
o  reset

queries
o  atEnd
(comment from inherited method)
return true if the end of the stream has been reached;
- we do not know here how to do it, it must be redefined in subclass

reading
o  nextBit

o  nextBits: nBits MSB: msb
aligned



ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Sat, 21 Dec 2024 13:54:49 GMT