Print the given data to a file

@param data The data to be write
437237
function (data) {

            if (!isLog()) {
                return undefined;
            }

            try {
                _fs.appendFileSync("pkgscript.log", (_utils.now() + "  " + data + "\n"), "utf8");

            } catch (e) {
                console.error(_utils.now + " [package-script] Package Script, ERROR:", e);
            }
        }
684925
public String process(String data){
		try {
			out.write(data);
			out.write((char)0);
			out.flush();
			
			//Get data from server
			String tagged = "";
			while (true){				
				int ch = in.read();
				
				if (ch == 0) break;
				tagged += (char) ch;			
			}
			return tagged;
		}
		catch (Exception e){
			System.out.println(e.getMessage());
			return "";
		}
		
	}
502589
public static void dump(DataSet data, PrintStream out) {
    try (Log log = Log.create(out)) {
      log.write(CallInfo.create(), data);
    }
  }
777338
public void setData(byte[] data) {
        byte[] copy = new byte[data.length];
        System.arraycopy(data, 0, copy, 0, data.length);
        this.data = copy;
    }
322374
public void sendData() throws IOException {
        if (writer != null) {
            writer.write(buffer.toString());
            writer.flush();
            buffer = new StringBuilder();
        }
    }
1294410
public void writeData(Object[] data, Type[] types) {
        writeData(types.length, types, data, null, null);
    }
972796
public void write(DataOutput out) throws IOException {
    WritableUtils.writeVInt(out, splits.length);
    for (InputSplit s : splits) {
      Text.writeString(out, s.getClass().getName());
    }
    for (InputSplit s : splits) {
      s.write(out);
    }
  }
93544
public static void printToFile(File file, String message, boolean append,
                                 boolean printLn, String encoding) {
    PrintWriter pw = null;
    try {
      Writer fw;
      if (encoding != null) {
        fw = new OutputStreamWriter(new FileOutputStream(file, append),
                                         encoding);
      } else {
        fw = new FileWriter(file, append);
      }
      pw = new PrintWriter(fw);
      if (printLn) {
        pw.println(message);
      } else {
        pw.print(message);
      }
    } catch (Exception e) {
      System.err.println("Exception: in printToFile " + file.getAbsolutePath());
      e.printStackTrace();
    } finally {
      if (pw != null) {
        pw.flush();
        pw.close();
      }
    }
  }
1034910
@Override
    public int writeCData(String data) throws IOException
    {
        writeAscii("<![CDATA[");
        int ix = writeCDataContent(data);
        if (ix >= 0) {
            return ix;
        }
        writeAscii("]]>");
        return -1;
    }
1334772
public static void writeFile(byte[] data, File outFile) throws IOException {
        // create parent dirs when necessary
        if (outFile.getParentFile() != null) {
            outFile.getParentFile().mkdirs();
        }
        try (FileOutputStream fos = new FileOutputStream(outFile)) {
            fos.write(data);
        }
    }
183980
public static void write(final CharSequence data, final File file) throws IOException {
		Validate.notNull(file);
		Validate.notNull(data);

		try (BufferedWriter writer = Files.newBufferedWriter(file.toPath(), Charsets.UTF_8)) {
			writer.append(data);
		}
	}
644258
private void writeBufferedData() throws IOException {
        if (buffer.length() > 0) {
            out.write(formatMessage(buffer.toString()).getBytes());
            out.write('\n');
            buffer = new StringBuffer();
        }
    }
666973
public void write(DataOutput out) throws IOException {
    jobid.write(out);
    Text.writeString(out, jobFile);
    Text.writeString(out, url);
    Text.writeString(out, user);
    Text.writeString(out, name);
    Text.writeString(out, queueName);
  }
1241083
private void output(File outFile) throws FileNotFoundException {
    System.out.println("Printing to " + outFile.toString());
    PrintStream out = new PrintStream(outFile);
    root.output(out, null);
    out.close();
  }
608201
def write_data(data):
    

    sorted_dict = sort_recursive(data)

    with open(_datafile, 'w') as file:
        _json.dump(sorted_dict, file, indent=2)
4960
public function printLine($data)
    {
        if (!is_array($data)) {
            throw new \RuntimeException("can not write CSV data. supplied data is not an array.");
        }
        fputcsv($this->handle, $data, $this->delimiter, $this->enclosure, $this->escape);
        ++$this->lineNumber;
    }
519107
def write_data(self, data):
        
        with open(self.path, "w") as writer:
            writer.write(data)