protected Set<BytesRef> decodeContexts(BytesRef scratch,ByteArrayDataInput tmpInput){
  tmpInput.reset(scratch.bytes,scratch.offset,scratch.length);
  tmpInput.skipBytes(scratch.length - 2);
  short ctxSetSize=tmpInput.readShort();
  scratch.length-=2;
  final Set<BytesRef> contextSet=new HashSet<>();
  for (short i=0; i < ctxSetSize; i++) {
    tmpInput.setPosition(scratch.offset + scratch.length - 2);
    short curContextLength=tmpInput.readShort();
    scratch.length-=2;
    tmpInput.setPosition(scratch.offset + scratch.length - curContextLength);
    BytesRef contextSpare=new BytesRef(curContextLength);
    tmpInput.readBytes(contextSpare.bytes,0,curContextLength);
    contextSpare.length=curContextLength;
    contextSet.add(contextSpare);
    scratch.length-=curContextLength;
  }
  return contextSet;
}

protected Set < BytesRef > decodeContexts ( BytesRef scratch , ByteArrayDataInput tmpInput ) { tmpInput . reset ( scratch . bytes , scratch . offset , scratch . length ) ; tmpInput . skipBytes ( scratch . length - 2 ) ; short ctxSetSize = tmpInput . readShort ( ) ; scratch . length -= 2 ; final Set < BytesRef > contextSet = new HashSet < > ( ) ; for ( short i = 0 ; i < ctxSetSize ; i ++ ) { tmpInput . setPosition ( scratch . offset + scratch . length - 2 ) ; short curContextLength = tmpInput . readShort ( ) ; scratch . length -= 2 ; tmpInput . setPosition ( scratch . offset + scratch . length - curContextLength ) ; BytesRef contextSpare = new BytesRef ( curContextLength ) ; tmpInput . readBytes ( contextSpare . bytes , 0 , curContextLength ) ; contextSpare . length = curContextLength ; contextSet . add ( contextSpare ) ; scratch . length -= curContextLength ; } return contextSet ; }
decodes the contexts at the current position
