Writes at most one chunk of data.
4653
def _WritePartial(self, data):
    """"""

    chunk = self.offset // self.chunksize
    chunk_offset = self.offset % self.chunksize
    data = utils.SmartStr(data)

    available_to_write = min(len(data), self.chunksize - chunk_offset)

    fd = self._GetChunkForWriting(chunk)
    fd.seek(chunk_offset)

    fd.write(data[:available_to_write])
    self.offset += available_to_write

    return data[available_to_write:]
395464
void writeBytes(byte[] bytes) throws IOException {
        int size = bytes.length;
        if (size < 256) {
            output.writeByte(BIN_8);
            output.writeByte(size);
        } else if (size < 65536) {
            output.writeByte(BIN_16);
            output.writeShort(size);
        } else {
            output.writeByte(BIN_32);
            output.writeInt(size);
        }
        output.write(bytes);
    }
413972
def write(self, data):
        """"""
        self.request(
            url="write",
            method='POST',
            params=None,
            data=data,
            expected_response_code=200
        )
        return True
56321
def _write(self, data, length, progress_callback=None):
    """"""
    if progress_callback:
      progress = self._handle_progress(length, progress_callback)
      six.next(progress)
    while length:
      tmp = data.read(FASTBOOT_DOWNLOAD_CHUNK_SIZE_KB * 1024)
      length -= len(tmp)
      self.usb.write(tmp)

      if progress_callback:
        progress.send(len(tmp))
663853
public void ser(DataOutput out) throws IOException {
    if (bits.length == 0) {
      out.writeByte(0);
      return;
    }
    // removing trailing empty bytes.
    int bytesToWrite;
    for (bytesToWrite = bits.length; bytesToWrite > 1 && bits[bytesToWrite - 1] == 0; bytesToWrite--) ;
    // Writing first bytes, with the rightmost bit set
    for (int i = 0; i < (bytesToWrite - 1); i++) {
      out.writeByte((bits[i] | 1));
    }
    // Writing the last byte, with the rightmost bit unset
    out.writeByte((bits[bytesToWrite - 1] & ~1));
  }
988462
@Override
	public void write(byte[] data)
    {
        int newCount = size+data.length; 
        ensureCapacity(newCount);
        System.arraycopy(data, 0, buf, size, data.length);
        size = newCount;
    }
468545
async def write(self, chunk: bytes,
                    *, drain: bool=True, LIMIT: int=0x10000) -> None:
        
        if self._on_chunk_sent is not None:
            await self._on_chunk_sent(chunk)

        if self._compress is not None:
            chunk = self._compress.compress(chunk)
            if not chunk:
                return

        if self.length is not None:
            chunk_len = len(chunk)
            if self.length >= chunk_len:
                self.length = self.length - chunk_len
            else:
                chunk = chunk[:self.length]
                self.length = 0
                if not chunk:
                    return

        if chunk:
            if self.chunked:
                chunk_len_pre = ('%x\r\n' % len(chunk)).encode('ascii')
                chunk = chunk_len_pre + chunk + b'\r\n'

            self._write(chunk)

            if self.buffer_size > LIMIT and drain:
                self.buffer_size = 0
                await self.drain()
638768
def write(self, data):
    
    block_remaining = _BLOCK_SIZE - self.__position % _BLOCK_SIZE

    if block_remaining < _HEADER_LENGTH:
      # Header won't fit into remainder
      self.__writer.write('\x00' * block_remaining)
      self.__position += block_remaining
      block_remaining = _BLOCK_SIZE

    if block_remaining < len(data) + _HEADER_LENGTH:
      first_chunk = data[:block_remaining - _HEADER_LENGTH]
      self.__write_record(_RECORD_TYPE_FIRST, first_chunk)
      data = data[len(first_chunk):]

      while True:
        block_remaining = _BLOCK_SIZE - self.__position % _BLOCK_SIZE
        if block_remaining >= len(data) + _HEADER_LENGTH:
          self.__write_record(_RECORD_TYPE_LAST, data)
          break
        else:
          chunk = data[:block_remaining - _HEADER_LENGTH]
          self.__write_record(_RECORD_TYPE_MIDDLE, chunk)
          data = data[len(chunk):]
    else:
      self.__write_record(_RECORD_TYPE_FULL, data)
587131
@Override
    public void write(byte[] b, int offset, int length) throws IOException {
        if (length == 0) {
            return;
        }
        int newcount = count + length;
        if (newcount > buf.length) {
            buf = Arrays.copyOf(buf, oversize(newcount));
        }
        System.arraycopy(b, offset, buf, count, length);
        count = newcount;
    }
1037379
public void writeZeroes(int bits) throws IOException {
        if (bits == 0) return;
        if (!ensureSize(bits)) throw new IOException("Memory Allocation Error");
        totalBits += bits;
        while (bits > 0) {
            int n = Math.min(BITS_PER_BLURB - outBits, bits);
            buffer[outBlurbs] <<= n;
            bits -= n;
            outBits += n;
            if (outBits == BITS_PER_BLURB) {
                outBlurbs++;
                outBits = 0;
            }
        }
    }
852168
def write(self, data):
        
        for _ in range(64 - len(data)):
            data.append(0)
        #logging.debug("send: %s", data)
        self.report.send(bytearray([0]) + data)
        return
655537
def _write(self, data):
        """"""
        stream = yaml.dump(data, default_flow_style=False)
        self.path.write_text(stream)
315651
def WriteFileChunk(self, chunk):
    """"""

    self._tar_fd.fileobj.write(chunk)
    self.cur_file_size += len(chunk)
    return self._stream.GetValueAndReset()
1212
def write(self, chunk):
        """"""
        if self.chunked_write and chunk:
            chunk_size_hex = hex(len(chunk))[2:].encode('ascii')
            buf = [chunk_size_hex, CRLF, chunk, CRLF]
            self.conn.wfile.write(EMPTY.join(buf))
        else:
            self.conn.wfile.write(chunk)
127663
def write_chunks(out, chunks):
    """"""

    out.write(signature)
    for chunk in chunks:
        write_chunk(out, *chunk)
519107
def write_data(self, data):
        
        with open(self.path, "w") as writer:
            writer.write(data)
446969
private int write1(byte b[], int off, int len) throws IOException {
    eventStartWrite();

    try {
      if(count==0 && bytesSentInChunk + len>=buf.length) {
        // local buffer is empty and user data can fill the current chunk
        // checksum and output data
        final int length = buf.length - bytesSentInChunk;
        sum.update(b, off, length);
        writeChecksumChunk(b, off, length, false);
        // start a new chunk
        bytesSentInChunk = 0;
        return length;
      }
    
      // copy user data to local buffer
      int bytesToCopy = buf.length - bytesSentInChunk - count;
      bytesToCopy = (len<bytesToCopy) ? len : bytesToCopy;
      sum.update(b, off, bytesToCopy);
      System.arraycopy(b, off, buf, count, bytesToCopy);
      count += bytesToCopy;
      if (count + bytesSentInChunk == buf.length) {
        // local buffer is full
        flushBuffer(true, shouldKeepPartialChunkData());
      } 
      return bytesToCopy;
    } finally {
      eventEndWrite();
    }
  }