code: private void downloadDataForStateHandle(
  		Path restoreFilePath,
  		StreamStateHandle remoteFileHandle,
  		CloseableRegistry closeableRegistry) throws IOException {
  
  		FSDataInputStream inputStream = null;
  		FSDataOutputStream outputStream = null;
  
  		try {
  			FileSystem restoreFileSystem = restoreFilePath.getFileSystem();
  			inputStream = remoteFileHandle.openInputStream();
  			closeableRegistry.registerCloseable(inputStream);
  
  			outputStream = restoreFileSystem.create(restoreFilePath, FileSystem.WriteMode.OVERWRITE);
  			closeableRegistry.registerCloseable(outputStream);
  
  			byte[] buffer = new byte[8 * 1024];
  			while (true) {
  				int numBytes = inputStream.read(buffer);
  				if (numBytes == -1) {
  					break;
  				}
  
  				outputStream.write(buffer, 0, numBytes);
  			}
  		} finally {
  			if (closeableRegistry.unregisterCloseable(inputStream)) {
  				inputStream.close();
  			}
  
  			if (closeableRegistry.unregisterCloseable(outputStream)) {
  				outputStream.close();
  			}
  		}
  	}
docs: Copies the file from a single state handle to the given path.