protected void readForward ( Decoder decoder ) throws IOException { short numberOfTokens = decoder . in . readVarShort ( 3 ) ; if ( 0 < numberOfTokens ) { long seek = decoder . in . peekLongCoord ( decoder . node . getCursorCount ( ) ) ; TrieNode toNode = decoder . node . traverse ( seek + decoder . node . getCursorIndex ( ) ) ; while ( toNode . getDepth ( ) > decoder . node . getDepth ( ) + numberOfTokens ) toNode = toNode . getParent ( ) ; Interval interval = decoder . node . intervalTo ( toNode ) ; String str = toNode . getString ( decoder . node ) ; Bits bits = interval . toBits ( ) ; if ( verbose != null ) { verbose . println ( String . format ( "Read %s forward from %s to %s = %s" , numberOfTokens , decoder . node . getDebugString ( ) , toNode . getDebugString ( ) , bits ) ) ; } decoder . in . expect ( bits ) ; decoder . out . append ( str ) ; decoder . node = toNode ; } else { assert ( 0 == decoder . node . index ) ; } }
Read forward .