code: public static void write(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount) throws IOException {
          Arrays.checkOffsetAndCount(bytes.length, byteOffset, byteCount);
          if (byteCount == 0) {
              return;
          }
          try {
              while (byteCount > 0) {
                  int bytesWritten = Libcore.os.write(fd, bytes, byteOffset, byteCount);
                  byteCount -= bytesWritten;
                  byteOffset += bytesWritten;
              }
          } catch (ErrnoException errnoException) {
              throw errnoException.rethrowAsIOException();
          }
      }
docs: java.io always writes every byte it's asked to, or fails with an error. (That is, unlike
  Unix it never just writes as many bytes as happens to be convenient.)