#NEWLINE# def encodeValue( self , encodeFun , value , defMode , maxChunkSize ) : #NEWLINE# #INDENT# if ( ( not maxChunkSize ) or ( len ( value ) <= ( maxChunkSize * 8 ) ) ) : #NEWLINE# #INDENT# out_len = ( ( len ( value ) + 7 ) // 8 ) #NEWLINE# out_list = ( out_len * [ 0 ] ) #NEWLINE# j = 7 #NEWLINE# i = ( - 1 ) #NEWLINE# for val in value : #NEWLINE# #INDENT# j += 1 #NEWLINE# if ( j == 8 ) : #NEWLINE# #INDENT# i += 1 #NEWLINE# j = 0 #NEWLINE# #UNINDENT# out_list [ i ] = ( out_list [ i ] | ( val << ( 7 - j ) ) ) #NEWLINE# #UNINDENT# return ( ( int2oct ( ( 7 - j ) ) + ints2octs ( out_list ) ) , 0 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# pos = 0 #NEWLINE# substrate = null #NEWLINE# while 1 : #NEWLINE# #INDENT# v = value . clone ( value [ ( pos * 8 ) : ( ( pos * 8 ) + ( maxChunkSize * 8 ) ) ] ) #NEWLINE# if ( not v ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# substrate = ( substrate + encodeFun ( v , defMode , maxChunkSize ) ) #NEWLINE# pos = ( pos + maxChunkSize ) #NEWLINE# #UNINDENT# return ( substrate , 1 )