public void loadWorkspaceContents(InputStream is) throws BlocklyParserException {
  List<Block> newBlocks=BlocklyXmlHelper.loadFromXml(is,mBlockFactory,mStats);
  SimpleArrayMap<String,String> varsMap=mVariableNameManager.getUsedNames();
  String[] vars=new String[varsMap.size()];
  for (int i=0; i < varsMap.size(); i++) {
    vars[i]=varsMap.keyAt(i);
  }
  mController.resetWorkspace();
  for (int i=0; i < vars.length; i++) {
    mController.addVariable(vars[i]);
  }
  mRootBlocks.addAll(newBlocks);
  for (int i=0; i < mRootBlocks.size(); i++) {
    mStats.collectStats(mRootBlocks.get(i),true);
  }
}

public void loadWorkspaceContents ( InputStream is ) throws BlocklyParserException { List < Block > newBlocks = BlocklyXmlHelper . loadFromXml ( is , mBlockFactory , mStats ) ; SimpleArrayMap < String , String > varsMap = mVariableNameManager . getUsedNames ( ) ; String [ ] vars = new String [ varsMap . size ( ) ] ; for ( int i = 0 ; i < varsMap . size ( ) ; i ++ ) { vars [ i ] = varsMap . keyAt ( i ) ; } mController . resetWorkspace ( ) ; for ( int i = 0 ; i < vars . length ; i ++ ) { mController . addVariable ( vars [ i ] ) ; } mRootBlocks . addAll ( newBlocks ) ; for ( int i = 0 ; i < mRootBlocks . size ( ) ; i ++ ) { mStats . collectStats ( mRootBlocks . get ( i ) , true ) ; } }
reads the workspace in from a xml stream . this will clear the workspace and replace it with the contents of the xml .
