code: public ScanWriter createScanWriter(int taskId, ScanDestination destination) {
          if (destination.isDiscarding()) {
              return _scanWriterFactory.createDiscardingScanWriter(taskId, Optional.<Integer>absent());
          }
  
          URI uri = destination.getUri();
          String scheme = uri.getScheme();
  
          if ("file".equals(scheme)) {
              return _scanWriterFactory.createFileScanWriter(taskId, uri, Optional.<Integer>absent());
          }
  
          if ("s3".equals(scheme)) {
              return _scanWriterFactory.createS3ScanWriter(taskId, uri, Optional.<Integer>absent());
          }
  
          throw new IllegalArgumentException("Unsupported destination: " + destination);
      }
docs: Creates a scan writer for the given destination.