code: public void write(byte[] buffer, int byteOffset, int byteCount) throws IOException {
          IoBridge.write(fd, buffer, byteOffset, byteCount);
          // if we are in "rws" mode, attempt to sync file+metadata
          if (syncMetadata) {
              fd.sync();
          }
      }
docs: Writes {@code byteCount} bytes from the byte array {@code buffer} to this
  file, starting at the current file pointer and using {@code byteOffset} as
  the first position within {@code buffer} to get bytes.
  
  @throws IndexOutOfBoundsException
  if {@code byteCount < 0}, {@code byteOffset < 0} or {@code byteCount +
  byteOffset} is greater than the size of {@code buffer}.
  @throws IOException
  if an I/O error occurs while writing to this file.