public returnTypes writeChunk(BackupChunk chunk) {
		String recID = Packet.bytesToHex(chunk.getFileID());
		for(BackupFile file : files) {
			String comID = Packet.bytesToHex(file.getFileID());
			if(comID.equals(recID)) {
				File restoredFile = new File(file.getFilename());
				if(!restoredFile.exists())
					try {restoredFile.createNewFile();} catch (IOException e) {e.printStackTrace();}
				
				try {
					BufferedOutputStream buffOut=new BufferedOutputStream(new FileOutputStream(restoredFile, true));
					buffOut.write(chunk.getData());
					buffOut.flush();
					buffOut.close();
					updateLog();
					return returnTypes.SUCCESS;
				} catch (FileNotFoundException e) {e.printStackTrace();} catch (IOException e) {e.printStackTrace();}
			}
		}
		
		return returnTypes.FAILURE;
	}