research/brotlidump.py
def processStream(self):
        """Process a brotli stream.
        """
        print('addr  hex{:{}s}binary context explanation'.format(
            '', self.width-10))
        print('Stream header'.center(60, '-'))
        self.windowSize = self.verboseRead(WindowSizeAlphabet())
        print('Metablock header'.center(60, '='))
        self.ISLAST = False
        self.output = bytearray()
        while not self.ISLAST:
            self.ISLAST = self.verboseRead(
                BoolCode('LAST', description="Last block"))
            if self.ISLAST:
                if self.verboseRead(
                    BoolCode('EMPTY', description="Empty block")): break
            if self.metablockLength(): continue
            if not self.ISLAST and self.uncompressed(): continue
            print('Block type descriptors'.center(60, '-'))
            self.numberOfBlockTypes = {}
            self.currentBlockCounts = {}
            self.blockTypeCodes = {}
            self.blockCountCodes = {}
            for blockType in (L,I,D): self.blockType(blockType)
            print('Distance code parameters'.center(60, '-'))
            self.NPOSTFIX, self.NDIRECT = self.verboseRead(DistanceParamAlphabet())
            self.readLiteralContextModes()
            print('Context maps'.center(60, '-'))
            self.cmaps = {}
            #keep the number of each kind of prefix tree for the last loop
            numberOfTrees = {I: self.numberOfBlockTypes[I]}
            for blockType in (L,D):
                numberOfTrees[blockType] = self.contextMap(blockType)
            print('Prefix code lists'.center(60, '-'))
            self.prefixCodes = {}
            for blockType in (L,I,D):
                self.readPrefixArray(blockType, numberOfTrees[blockType])
            self.metablock()
def processStream(self):
        """Process a brotli stream.
        """
        print('addr  hex{:{}s}binary context explanation'.format(
            '', self.width-10))
        print('Stream header'.center(60, '-'))
        self.windowSize = self.verboseRead(WindowSizeAlphabet())
        print('Metablock header'.center(60, '='))
        self.ISLAST = False
        self.output = bytearray()
        while not self.ISLAST:
            self.ISLAST = self.verboseRead(
                BoolCode('LAST', description="Last block"))
            if self.ISLAST:
                if self.verboseRead(
                    BoolCode('EMPTY', description="Empty block")): break
            if self.metablockLength(): continue
            if not self.ISLAST and self.uncompressed(): continue
            print('Block type descriptors'.center(60, '-'))
            self.numberOfBlockTypes = {}
            self.currentBlockCounts = {}
            self.blockTypeCodes = {}
            self.blockCountCodes = {}
            for blockType in (L,I,D): self.blockType(blockType)
            print('Distance code parameters'.center(60, '-'))
            self.NPOSTFIX, self.NDIRECT = self.verboseRead(DistanceParamAlphabet())
            self.readLiteralContextModes()
            print('Context maps'.center(60, '-'))
            self.cmaps = {}
            #keep the number of each kind of prefix tree for the last loop
            numberOfTrees = {I: self.numberOfBlockTypes[I]}
            for blockType in (L,D):
                numberOfTrees[blockType] = self.contextMap(blockType)
            print('Prefix code lists'.center(60, '-'))
            self.prefixCodes = {}
            for blockType in (L,I,D):
                self.readPrefixArray(blockType, numberOfTrees[blockType])
            self.metablock()
def processStream ( self ) : print ( 'addr  hex{:{}s}binary context explanation' . format ( '' , self . width - 10 ) ) print ( 'Stream header' . center ( 60 , '-' ) ) self . windowSize = self . verboseRead ( WindowSizeAlphabet ( ) ) print ( 'Metablock header' . center ( 60 , '=' ) ) self . ISLAST = False self . output = bytearray ( ) while not self . ISLAST : self . ISLAST = self . verboseRead ( BoolCode ( 'LAST' , description = "Last block" ) ) if self . ISLAST : if self . verboseRead ( BoolCode ( 'EMPTY' , description = "Empty block" ) ) : break if self . metablockLength ( ) : continue if not self . ISLAST and self . uncompressed ( ) : continue print ( 'Block type descriptors' . center ( 60 , '-' ) ) self . numberOfBlockTypes = { } self . currentBlockCounts = { } self . blockTypeCodes = { } self . blockCountCodes = { } for blockType in ( L , I , D ) : self . blockType ( blockType ) print ( 'Distance code parameters' . center ( 60 , '-' ) ) self . NPOSTFIX , self . NDIRECT = self . verboseRead ( DistanceParamAlphabet ( ) ) self . readLiteralContextModes ( ) print ( 'Context maps' . center ( 60 , '-' ) ) self . cmaps = { } #keep the number of each kind of prefix tree for the last loop numberOfTrees = { I : self . numberOfBlockTypes [ I ] } for blockType in ( L , D ) : numberOfTrees [ blockType ] = self . contextMap ( blockType ) print ( 'Prefix code lists' . center ( 60 , '-' ) ) self . prefixCodes = { } for blockType in ( L , I , D ) : self . readPrefixArray ( blockType , numberOfTrees [ blockType ] ) self . metablock ( )
Process a brotli stream.
Process a brotli stream .