public String[] toFile(TimedTextObject tto) {
		
		//first we check if the TimedTextObject had been built, otherwise...
		if(!tto.built)
			return null;

		//we will write the lines in an ArrayList,
		int index = 0;
		//the minimum size of the file is 4*number of captions, so we'll take some extra space.
		ArrayList<String> file = new ArrayList<>(5 * tto.captions.size());
		//we iterate over our captions collection, they are ordered since they come from a TreeMap
		Collection<Caption> c = tto.captions.values();
		Iterator<Caption> itr = c.iterator();
		int captionNumber = 1;

		while(itr.hasNext()){
			//new caption
			Caption current = itr.next();
			//number is written
			file.add(index++, Integer.toString(captionNumber++));
			//we check for offset value:
			if(tto.offset != 0){
				current.start.mseconds += tto.offset;
				current.end.mseconds += tto.offset;
			}
			//time is written
			file.add(index++,current.start.getTime("hh:mm:ss,ms")+" --> "+current.end.getTime("hh:mm:ss,ms"));
			//offset is undone
			if(tto.offset != 0){
				current.start.mseconds -= tto.offset;
				current.end.mseconds -= tto.offset;
			}
			//text is added
			String[] lines = cleanTextForSRT(current);
			int i=0;
			while(i<lines.length)
				file.add(index++,""+lines[i++]);
			//we add the next blank line
			file.add(index++,"");
		}

		String[] toReturn = new String [file.size()];
		for (int i = 0; i < toReturn.length; i++) {
			toReturn[i] = file.get(i);
		}
		return toReturn;
	}