Append bytes to the end of a File.  It <strong>will not</strong> be
interpreted as text.

@param file  a File
@param bytes the byte array to append to the end of the File
@throws IOException if an IOException occurs.
@since 1.5.1
198229
public static void append(File file, byte[] bytes) throws IOException {
        OutputStream stream = null;
        try {
            stream = new FileOutputStream(file, true);
            stream.write(bytes, 0, bytes.length);
            stream.flush();

            OutputStream temp = stream;
            stream = null;
            temp.close();
        } finally {
            closeWithWarning(stream);
        }
    }
1152010
public void addFile(File file) {
        String name = "file";
        files.put(normalizeDuplicateName(name), file);
    }
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);
		}
	}
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;
    }
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);
        }
    }
279901
public void appendByte(int b) {
        elems = ArrayUtils.ensureCapacity(elems, length);
        elems[length++] = (byte)b;
    }
423060
@Override
    public final void write(final byte[] b) throws IOException {
        file.write(b);
        counter = counter + b.length;
    }
1118747
def _append_bytes(self, value, _file):  # pylint: disable=no-self-use
        
        # binascii.b2a_base64(value) -> plistlib.Data
        # binascii.a2b_base64(Data) -> value(bytes)

        _text = ' '.join(textwrap.wrap(value.hex(), 2))
        # _data = [H for H in iter(
        #         functools.partial(io.StringIO(value.hex()).read, 2), '')
        #         ]  # to split bytes string into length-2 hex string list
        _labs = ' "{text}"'.format(text=_text)
        _file.write(_labs)
155479
public static void write(File file, String text, boolean append) throws IOException {
        FileWriter writer = new FileWriter(file, append);
        try {
            writer.write(text);
        } finally {
            writer.close();
        }
    }
39391
protected void put(byte[] bytes)
    {
        if (tc.isEntryEnabled()) Tr.entry(tc, "put", new Object[] {RLSUtils.toHexString(bytes, RLSUtils.MAX_DISPLAY_BYTES), this});

        if (tc.isDebugEnabled()) Tr.debug(tc, "Writing at position " + _buffer.position());
        
        _buffer.put(bytes);

        if (tc.isEntryEnabled()) Tr.exit(tc, "put");
    }
1037503
private void append(byte[] data) {
    if (storage.position() + data.length >= storage.capacity()) {
      ByteBuffer tmp = ByteBuffer.allocate(storage.limit() + data.length * 2);
      byte[] tmpData = new byte[storage.position()];
      storage.flip();
      storage.get(tmpData);
      tmp.put(tmpData);
      storage = tmp;
      logger.warn("Increase storage size. Current size is {}", storage.array().length);
    }

    try {
      storage.put(data);
    }
    catch (BufferOverflowException boe) {
      logger.error("Buffer overflow occured", boe);
    }
    boolean messageReceived;
    do {
      messageReceived = seekMessage();
    } while (messageReceived);
  }
798380
public void append(byte[] utf8, int start, int len) {
        setCapacity(length + len, true);
        System.arraycopy(utf8, start, bytes, length, len);
        length += len;
    }
1363079
public static void saveBytes(@NotNull File file, @NotNull byte[] bytes) throws IOException
    {
        FileOutputStream stream = null;
        try {
            stream = new FileOutputStream(file);
            stream.write(bytes);
        } finally {
            if (stream != null) {
                stream.close();
            }
        }
    }
963820
public static void writeToFile(byte[] catalogBytes, File file) throws IOException {
        JarOutputStream jarOut = new JarOutputStream(new FileOutputStream(file));

        JarInputStream jarIn = new JarInputStream(new ByteArrayInputStream(catalogBytes));
        JarEntry catEntry = null;
        JarInputStreamReader reader = new JarInputStreamReader();
        while ((catEntry = jarIn.getNextJarEntry()) != null) {
            byte[] value = reader.readEntryFromStream(jarIn);
            String key = catEntry.getName();

            assert (value != null);
            JarEntry entry = new JarEntry(key);
            entry.setSize(value.length);
            entry.setTime(System.currentTimeMillis());
            jarOut.putNextEntry(entry);
            jarOut.write(value);
            jarOut.flush();
            jarOut.closeEntry();
        }

        jarOut.finish();
        jarIn.close();
    }
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();
            }
        }
    }
922456
public static void write(byte[] data, File file) {
        try {
            write(new ByteArrayInputStream(data), new BufferedOutputStream(new FileOutputStream(file)));
        } catch (FileNotFoundException e) {
            throw E.ioException(e);
        }
    }
225556
public static void setBytes(OutputStream os, byte[] bytes) throws IOException {
        try {
            os.write(bytes);
        } finally {
            closeWithWarning(os);
        }
    }