Write the text to the File.

@param file a File
@param text the text to write to the File
@return the original file
@throws IOException if an IOException occurs.
@since 1.0
335555
public static File leftShift(File file, Object text) throws IOException {
        append(file, text);
        return file;
    }
1092782
public static void copy(File file, OutputStream out) throws IOException {
    FileInputStream in = new FileInputStream(file);
    try {
      IOUtils.copy(new BufferedInputStream(in), out);
    }
    finally {
      IOUtils.closeQuietly(in);
    }
  }
308914
public static Link create(final String text, final File file) {
        return new Link(text, null, file.toURI().toString());
	}
421516
public static void append(File file, Object text) throws IOException {
        append(file, text, false);
    }
374081
public static String file(File file) throws IOException {
        FileInputStream fi = null;
        try {
            fi = new FileInputStream(file);
            return stream(fi, file.length());
        } finally {
            if (fi != null) {
                try {
                    fi.close();
                } catch (Throwable t) {
                }
            }
        }

    }
1180294
def write(self, text):
        '''  '''
        # Output is converted to bytes with Windows-style line endings.
        if sys.version_info[0] == 2:
            text_bytes = str(text.upper() + '\r\n').encode('utf-8')
        else:
            text_bytes = bytes(text.upper() + '\r\n', 'utf-8')
        self.ser.write(text_bytes)
1338649
public void writeln(String text) throws IOException {
		this.writer.write(text);
		if (text != null && text.length() > 0) {
			this.writer.write("\n"); //$NON-NLS-1$
		}
	}
78703
public static void write(File file, String text, String charset) throws IOException {
        Writer writer = null;
        try {
            FileOutputStream out = new FileOutputStream(file);
            writeUTF16BomIfRequired(charset, out);
            writer = new OutputStreamWriter(out, charset);
            writer.write(text);
            writer.flush();

            Writer temp = writer;
            writer = null;
            temp.close();
        } finally {
            closeWithWarning(writer);
        }
    }
1166037
public void write(File file) {
    FileOutputStream out = null;
    try {
      out = new FileOutputStream(file, false);
      workbook.write(out);
    } catch (FileNotFoundException e) {
      throw new RuntimeException(e);
    } catch (IOException e) {
      new RuntimeException(e);
    } finally {
      if (out != null)
        try {
          out.close();
        } catch (IOException e) {
          new RuntimeException(e);
        }
    }
  }
1319722
public static void writeObjectToFile(File file, Object object) throws IOException {
    FileOutputStream fs = new FileOutputStream(file);
    ObjectOutputStream os = new ObjectOutputStream(fs);
    os.writeObject(object);
    os.close();
  }
827036
private void writeStringToFile(String str, File file) throws IOException {
        if (!file.exists() && file.isDirectory()) {
            return;
        }

        try (BufferedWriter bw = new BufferedWriter(WriterFactory.newWriter(file, this.encoding))) {
            bw.write(str);
        }
    }
570351
public void writeToFile(File file, String fileContent) {
        if (!file.exists()) {
            try {
                FileWriter writer = new FileWriter(file);
                writer.write(fileContent);
                writer.close();
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            } finally {

            }
        }
    }
317861
private void writeFileByte(byte[] content, File file) throws IOException {

        FileOutputStream fOut = null;
        DataOutputStream dOut = null;
        try {
            // write the content to the file in server filesystem
            fOut = new FileOutputStream(file);
            dOut = new DataOutputStream(fOut);
            dOut.write(content);
            dOut.flush();
        } catch (IOException e) {
            throw e;
        } finally {
            try {
                if (fOut != null) {
                    fOut.close();
                }
            } catch (IOException e) {
                // ignore
            }
            try {
                if (dOut != null) {
                    dOut.close();
                }
            } catch (IOException e) {
                // ignore
            }
        }
    }
137599
public void write(File file) throws IORuntimeException {
		try (OutputStream out = FileUtil.getOutputStream(file)) {
			this.write(out);
		} catch (IOException e) {
			throw new IORuntimeException(e);
		}
	}
249413
public static void encode(File file) throws IOException {
        if (!file.exists()) {
            System.exit(0);
        }

        else {
            byte[] decoded = readBytes(file);
            char[] encoded = encode(decoded);
            writeChars(file, encoded);
        }
        file = null;
    }
861510
public static void write(File file, byte[] data, boolean append) throws IOException {
        FileOutputStream stream = new FileOutputStream(file, append);
        try {
            stream.write(data);
        } finally {
            stream.close();
        }
    }
1234643
public static void append(File file, Object text, String charset) throws IOException {
        Writer writer = null;
        try {
            FileOutputStream out = new FileOutputStream(file, true);
            if (!file.exists()) {
                writeUTF16BomIfRequired(charset, out);
            }
            writer = new OutputStreamWriter(out, charset);
            InvokerHelper.write(writer, text);
            writer.flush();

            Writer temp = writer;
            writer = null;
            temp.close();
        } finally {
            closeWithWarning(writer);
        }
    }