public void saveData(final String contents) throws IOException {
		Configuration conf = new Configuration();
		// conf.set("yarn.resourcemanager.address","localhost:9005");
		// conf.set("fs.defaultFS","hdfs://localhost:9000");
		// conf.set("mapreduce.framework.name", "yarn");
		// conf.set("yarn.resourcemanager.scheduler.address", "localhost:8030");
		
		buffer.add(contents);
		ArrayList<String> bufferedData = buffer.getReadyBufferedContent();
		
		// Only store data if the buffer gave us some ready data. Buffer decides if we should store data or not.
		if (bufferedData.size() > 0) {
			
			if (!useHDFS) {
				try (PrintWriter out = new PrintWriter(new BufferedWriter(
				new FileWriter(SiriDownload.filePath
						+ file, true)))) {
					for (String str : bufferedData) {
						out.println(str);				
					}		
				}
			}
			
			else {
				try (FileSystem fs = DistributedFileSystem.get(conf)) {					
					// If the file doesn't exist, create it
					if (!fs.exists(path)) {
						try (FSDataOutputStream fsout2 = fs.create(path)) { }
					}
			
					try (FSDataOutputStream fsout = fs.append(path)) {
						try (PrintWriter writer = new PrintWriter(fsout)) {
							//logger.info("Starting append on thread: " + Thread.currentThread().getId() + " stamp: " + new SimpleDateFormat("yyyyddMM-HHmmss").format(new Date()));
							
							for (String str : bufferedData) {
								writer.println(str);
							}						
							
							//logger.info("Ending append on thread: " + Thread.currentThread().getId() + " stamp: " + new SimpleDateFormat("yyyyddMM-HHmmss").format(new Date()));
						}	catch (Exception e) {
							logger.error("writer error: " + e);
						}
					} catch (Exception e) {
						logger.error("FSData error: " + e);
					}
				} catch (Exception e) {
					logger.error("Stream error: " + e);
				}
			}
			
			buffer.emptyBuffer(); // We may have lost data (not saved it) due to exceptions.
		}
	}