Write bytes to the given file.
178749
public static void writeFile(File file, byte[] bytes) throws IOException {
        FileOutputStream fos = null;
        try {
            fos = new FileOutputStream(file);
            fos.write(bytes);
        } finally {
            if (fos != null) {
                fos.close();
            }
        }
    }
1140799
def __write(self, s):
        
        self.buf += s
        while len(self.buf) > self.bufsize:
            self.fileobj.write(self.buf[:self.bufsize])
            self.buf = self.buf[self.bufsize:]
155847
def _write(self, str_buf):
    """"""
    self._filehandle.write(str_buf)
    self._buf_size += len(str_buf)
845776
public static void writeByteArrayToFile(final File file, final byte[] byteArray)
		throws IOException
	{
		try (FileOutputStream fos = new FileOutputStream(file);
			BufferedOutputStream bos = new BufferedOutputStream(fos))
		{
			bos.write(byteArray);
		}
		catch (final FileNotFoundException ex)
		{
			throw ex;
		}
		catch (final IOException ex)
		{
			throw ex;
		}
	}
1374524
public BinaryEncoder writeBytes(byte[] bytes) throws IOException {
    writeLong(bytes.length);
    output.write(bytes, 0, bytes.length);
    return this;
  }
549938
public static void setBytes(File file, byte[] bytes) throws IOException {
        IOGroovyMethods.setBytes(new FileOutputStream(file), bytes);
    }
1266230
def to_file(self, filename):
		
		with open(filename, 'wb') as f:
			f.write(self.to_bytes())
315651
def WriteFileChunk(self, chunk):
    """"""

    self._tar_fd.fileobj.write(chunk)
    self.cur_file_size += len(chunk)
    return self._stream.GetValueAndReset()
676682
@Override
    public void write(byte[] b) throws IOException {
        if (b.length == 0)
            return;
        fos().write(b);
        currFileBytesWritten += b.length;
        totalBytesWritten += b.length;
    }
849199
def write_file(self, file, verbose=False):
        """"""
        dat = self.get_midi_data()
        try:
            f = open(file, 'wb')
        except:
            print "Couldn't open '%s' for writing." % file
            return False
        try:
            f.write(dat)
        except:
            print 'An error occured while writing data to %s.' % file
            return False
        f.close()
        if verbose:
            print 'Written %d bytes to %s.' % (len(dat), file)
        return True
1328023
def write_text(self, name, s):
        """"""
        buf = io.BytesIO(compat.to_bytes(s))
        self.write_file(name, buf)
191155
def write(self, data):
        """"""
        data = data.encode('utf-8')
        data_p = ctypes.create_string_buffer(data)
        num_bytes = PLARGE_INTEGER(LARGE_INTEGER(0))
        bytes_to_write = len(data)
        success = WriteFile(self.conin_pipe, data_p,
                            bytes_to_write, num_bytes, None)
        return success, num_bytes[0]
613342
public static void writeFile (byte[] bytes, String targetFileName) throws OSHelperException {
		FileOutputStream fos;
		try {
			fos = new FileOutputStream (targetFileName);
		} catch (FileNotFoundException ex) {
			throw new OSHelperException ("Received a FileNotFoundException when trying to open target file " + targetFileName + ".", ex);
		}
		try {
			fos.write (bytes);
		} catch (IOException ex) {
			throw new OSHelperException ("Received an IOException when trying to write to target file " + targetFileName + ".", ex);
		} finally {
			try {
				fos.close ();
			} catch (IOException ex) {
				throw new OSHelperException ("Received an IOException when trying to close FileOutputStream for target file " + targetFileName + ".", ex);
			}
		}
	}
801676
def writefile(openedfile, newcontents):
    """"""
    openedfile.seek(0)
    openedfile.truncate()
    openedfile.write(newcontents)
1195813
public void write(byte[] b, int off, int len) throws IOException {
        out.write(b, off, len);
        cksum.update(b, off, len);
    }
1021936
public static void writeByteArrayToFile(final String filename, final byte[] byteArray)
		throws IOException
	{
		final File file = new File(filename);
		writeByteArrayToFile(file, byteArray);
	}
1334541
def save_to(self, file):
        """"""
        dest = file

        if hasattr(dest, 'write'):
            # writing to a file-like
            # only works when no unicode conversion is done
            if self.file is not None and\
                    getattr(self.file, 'encoding', None) is None:
                copyfileobj(self.file, dest)
            elif self.filename is not None:
                with open(self.filename, 'rb') as inp:
                    copyfileobj(inp, dest)
            else:
                dest.write(self.__bytes__())
        else:
            # we do not use filesystem io to make sure we have the same
            # permissions all around
            # copyfileobj() should be efficient enough

            # destination is a filename
            with open(dest, 'wb') as out:
                return self.save_to(out)