code: public void sendInstances(Stream inputStream,
  														int numberInstances, boolean isTraining, boolean isTesting) {
  		int numberSamples = 0;
  
  		while (streamSource.hasMoreInstances()
  				&& numberSamples < numberInstances) {
  			
  			numberSamples++;
  			numberInstancesSent++;
  			InstanceContentEvent instanceContentEvent = new InstanceContentEvent(
  					numberInstancesSent, nextInstance(), isTraining, isTesting);
  		
  			
  			inputStream.put(instanceContentEvent);
  		}
  
  		InstanceContentEvent instanceContentEvent = new InstanceContentEvent(
  				numberInstancesSent, null, isTraining, isTesting);
  		instanceContentEvent.setLast(true);
  		inputStream.put(instanceContentEvent);
  	}
docs: Send instances.
  @param inputStream the input stream
  @param numberInstances the number instances
  @param isTraining the is training