Writes the data contained in the {@link TemporalSemanticSpace} to the
provided file using the {@link TSSpaceFormat#TEXT} format.  See <a
href="#format">here</a> for file format specifications.
322765
public static void printTemporalSemanticSpace(TemporalSemanticSpace sspace,
                                                  File output) 
        throws IOException {
        printTemporalSemanticSpace(sspace, output, TSSpaceFormat.TEXT);
    }
1328969
public void formatWriter(File templateDir, String templateName,
			Object aBindMap, String dateFormat, Writer writer)
			throws IOException, FormatException
	{
		// TODO Auto-generated method stub

	}
83507
public static void write(File file, String text) throws IOException {
        Writer writer = null;
        try {
            writer = new FileWriter(file);
            writer.write(text);
            writer.flush();

            Writer temp = writer;
            writer = null;
            temp.close();
        } finally {
            closeWithWarning(writer);
        }
    }
1238489
public static void write(Path self, String text, String charset) throws IOException {
        Writer writer = null;
        try {
            writer = new OutputStreamWriter(Files.newOutputStream(self, CREATE, APPEND), Charset.forName(charset));
            writer.write(text);
            writer.flush();

            Writer temp = writer;
            writer = null;
            temp.close();
        } finally {
            closeWithWarning(writer);
        }
    }
110098
public static void writeMemento(final File resourceDir, final Resource resource,
            final Instant time) {
        try (final BufferedWriter writer = newBufferedWriter(
                        getNquadsFile(resourceDir, time).toPath(), UTF_8, CREATE, WRITE,
                        TRUNCATE_EXISTING)) {

            try (final Stream<String> quads = generateServerManaged(resource).map(FileUtils::serializeQuad)) {
                final Iterator<String> lineIter = quads.iterator();
                while (lineIter.hasNext()) {
                    writer.write(lineIter.next() + lineSeparator());
                }
            }

            try (final Stream<String> quads = resource.stream().filter(FileUtils::notServerManaged)
                    .map(FileUtils::serializeQuad)) {
                final Iterator<String> lineiter = quads.iterator();
                while (lineiter.hasNext()) {
                    writer.write(lineiter.next() + lineSeparator());
                }
            }
        } catch (final IOException ex) {
            throw new UncheckedIOException(
                            "Error writing resource version for " + resource.getIdentifier().getIRIString(), ex);
        }
    }
12948
private Map<String,SemanticVector> loadSparseText(File sspaceFile) 
        throws IOException {

        LOGGER.info("loading sparse text TSS from " + sspaceFile);

        BufferedReader br = new BufferedReader(new FileReader(sspaceFile));
        String[] header = br.readLine().split("\\s+");
        int words = Integer.parseInt(header[0]);
        dimensions = Integer.parseInt(header[1]);
        
        Map<String,SemanticVector> wordToSemantics = 
            new HashMap<String,SemanticVector>(words, 2f);
            
        for (int wordIndex = 0; wordIndex < words; ++wordIndex) {
            String[] wordAndSemantics = br.readLine().split("\\|");
            String word = wordAndSemantics[0];
            SemanticVector semantics = new SemanticVector(dimensions);
            wordToSemantics.put(word, semantics);

            LOGGER.info("loading " + wordAndSemantics.length + 
                " timesteps for word " + word); 

            // read in each of the timesteps
            for (int tsIndx = 1; tsIndx < wordAndSemantics.length; ++tsIndx) {
                String[] tsAndVec = wordAndSemantics[tsIndx].split("%");
                String[] tsAndNonZero = tsAndVec[0].split(" ");
                long timeStep = Long.parseLong(tsAndNonZero[0]);
                updateTimeRange(timeStep);
                int nonZero = Integer.parseInt(tsAndNonZero[1]);
                String[] vecElements = tsAndVec[1].split(",");
                
                Map<Integer,Double> sparseArr = new IntegerMap<Double>();
                // elements are ordered as pairs of index,value,index,value,...
                for (int i = 0; i < vecElements.length; i += 2) {
                    Integer index = Integer.valueOf(vecElements[i]);
                    Double value = Double.valueOf(vecElements[i+1]);
                }
                semantics.setSemantics(timeStep, sparseArr);
            }
        }

        return wordToSemantics;
    }
721283
public synchronized void writeHeader(long timestamp) throws IOException {
		if (writer == null && headerBytes != null) {
			writer = createNewWriter(manager.startNewFile(timestamp));
			writer.write(headerBytes);
			manager.notifyOfFileAction(LogEventListener.EVENTTYPEROLL) ;
		}
	}
1300717
@Override
  public void write(DataOutput out) throws IOException {
    Text.writeString(out, file.toString());
    out.writeLong(start);
    out.writeLong(length);
  }
737953
public void writeTreesInOneLineFormat(File outFile) throws IOException {
        BufferedWriter writer = new BufferedWriter(new FileWriter(outFile));
        for (BinaryTree tree : this) {
            writer.write(tree.getAsOneLineString());
            writer.write("\n");
        }
        writer.close();        
    }
1288054
private void writeTimeMLDocument(Document xmlDoc, String filename) {
		// create output file handle
		File outFile = new File(mOutputDir, filename+".tml"); 
		
		BufferedWriter bw = null;
		try {
			// create a buffered writer for the output file
			bw = new BufferedWriter(new FileWriter(outFile));
			
			// prepare the transformer to convert from the xml doc to output text
			Transformer transformer = TransformerFactory.newInstance().newTransformer();
			// some pretty printing
			transformer.setOutputProperty(OutputKeys.INDENT, "no");
			DOMSource source = new DOMSource(xmlDoc);
			StreamResult result = new StreamResult(bw);
			
			// transform
			transformer.transform(source, result);
		} catch (IOException e) { // something went wrong with the bufferedwriter
			e.printStackTrace();
			Logger.printError(component, "File "+outFile.getAbsolutePath()+" could not be written.");
		} catch (TransformerException e) { // the transformer malfunctioned (call optimus prime)
			e.printStackTrace();
			Logger.printError(component, "XML transformer could not be properly initialized.");
		} finally { // clean up for the bufferedwriter
			try {
				bw.close();
			} catch(IOException e) {
				e.printStackTrace();
				Logger.printError(component, "File "+outFile.getAbsolutePath()+" could not be closed.");
			}
		}
	}
751234
private void writeObject(ObjectOutputStream out) throws IOException {
        out.defaultWriteObject();
        // If the SemanticSpace that was provided is already serializable, then
        // just write it to the stream as is
        if (sspace instanceof Serializable) {
            out.writeObject(sspace);
        }
        // Otherwise, in order to serialize this instance, wrap the data in a
        // dummy SemanticSpace that contains the equivalent term-vector mapping
        else {
            verbose(LOGGER, "%s is not serializable, so writing a copy " +
                    "of the data", sspace.getSpaceName());
            Map<String,Vector> termToVector = 
                new HashMap<String,Vector>(sspace.getWords().size());
            for (String term : sspace.getWords()) 
                termToVector.put(term, sspace.getVector(term));
            SemanticSpace copy = new VectorMapSemanticSpace<Vector>(
                termToVector, "copy of " + sspace.getSpaceName(),
                sspace.getVectorLength());
            out.writeObject(copy);
        }
    }
782695
private void writeDurationField(String fieldName, Object value) throws IOException
   {
      if (value instanceof String)
      {
         m_writer.writeNameValuePair(fieldName + "_text", (String) value);
      }
      else
      {
         Duration val = (Duration) value;
         if (val.getDuration() != 0)
         {
            Duration minutes = val.convertUnits(TimeUnit.MINUTES, m_projectFile.getProjectProperties());
            long seconds = (long) (minutes.getDuration() * 60.0);
            m_writer.writeNameValuePair(fieldName, seconds);
         }
      }
   }
497598
public TextBuilder styledLink(final String text, final TextStyle ts, final File file) {
        this.curParagraphBuilder.styledLink(text, ts, file);
        return this;
    }
30467
public final void write(T t, MediaType contentType, HttpOutputMessage outputMessage)
			throws IOException, HttpMessageNotWritableException {

		HttpHeaders headers = outputMessage.getHeaders();
		if (headers.getContentType() == null) {
			MediaType contentTypeToUse = contentType;
			if (contentType == null || contentType.isWildcardType() || contentType.isWildcardSubtype()) {
				contentTypeToUse = getDefaultContentType(t);
			}
			if (contentTypeToUse != null) {
				headers.setContentType(contentTypeToUse);
			}
		}
		if (headers.getContentLength() == -1) {
			Long contentLength = getContentLength(t, headers.getContentType());
			if (contentLength != null) {
				headers.setContentLength(contentLength);
			}
		}
		writeInternal(t, outputMessage);
		outputMessage.getBody().flush();
	}
163608
public void writeTimestamp(Timestamp timestamp) throws IOException {
		_writeArrayFieldNameIfNeeded();
		_verifyValueWrite("write timestamp");
		_buffer.putByte(_typeMarker, BsonConstants.TYPE_TIMESTAMP);
		_buffer.putInt(timestamp.getInc());
		_buffer.putInt(timestamp.getTime());
		flushBuffer();
	}
1127999
function(file, t) {
		var self = this, 
			ts   = t || file.ts, 
			i18  = self.i18,
			date, format, output, d, dw, m, y, h, g, i, s;

		if (self.options.clientFormatDate && ts > 0) {

			date = new Date(ts*1000);
			format = ts >= this.yesterday 
				? this.fancyFormat 
				: this.dateFormat;

			output = self.date(format, date);
			
			return ts >= this.yesterday
				? output.replace('$1', this.i18n(ts >= this.today ? 'Today' : 'Yesterday'))
				: output;
		} else if (file.date) {
			return file.date.replace(/([a-z]+)\s/i, function(a1, a2) { return self.i18n(a2)+' '; });
		}
		
		return self.i18n('dateUnknown');
	}
613943
private File writeFile(final FormFile fileItem) throws Exception {
		final String directory = this.getFileDir(fileItem.getContentType());

		// TODO: ensure unique file names
		final File file = new File(directory + System.currentTimeMillis() + "-"
				+ fileItem.getOriginalFileName());
		fileItem.getFormItem().write(file);
		return file;
	}