Send output with fixed length data
185836
def outputdata(self, data):
        
        if not isinstance(data, bytes):
            data = str(data).encode(self.encoding)
        self.output(MemoryStream(data))
1308206
def send_data(self):
        """"""
        if not self.connection._sock:
            raise err.InterfaceError("(0, '')")
        conn = self.connection

        try:
            with open(self.filename, 'rb') as open_file:
                packet_size = min(conn.max_allowed_packet, 16*1024)  # 16KB is efficient enough
                while True:
                    chunk = open_file.read(packet_size)
                    if not chunk:
                        break
                    conn.write_packet(chunk)
        except IOError:
            raise err.OperationalError(1017, "Can't find file '{0}'".format(self.filename))
        finally:
            # send the empty packet to signify we are done sending data
            conn.write_packet(b'')
311160
def send(self):
        """"""
        self._file.write(self.as_bytes())
        self._file.write(b'\r\n')
948034
def send_output_report(self, data):
        
        assert( self.is_opened() )
        #make sure we have c_ubyte array storage
        if not ( isinstance(data, ctypes.Array) and \
                issubclass(data._type_, c_ubyte) ):
            raw_data_type = c_ubyte * len(data)
            raw_data = raw_data_type()
            for index in range( len(data) ):
                raw_data[index] = data[index]
        else:
            raw_data = data
        #
        # Adding a lock when writing (overlapped writes)
        over_write = winapi.OVERLAPPED()
        over_write.h_event = winapi.CreateEvent(None, 0, 0, None)
        if over_write.h_event:
            try:
                overlapped_write = over_write
                winapi.WriteFile(int(self.hid_handle), byref(raw_data), len(raw_data),
                    None, byref(overlapped_write)) #none overlapped
                error = ctypes.GetLastError()
                if error == winapi.ERROR_IO_PENDING:
                    # overlapped operation in progress
                    result = error
                elif error == 1167:
                    raise HIDError("Error device disconnected before write")
                else:
                    raise HIDError("Error %d when trying to write to HID "\
                        "device: %s"%(error, ctypes.FormatError(error)) )
                result = winapi.WaitForSingleObject(overlapped_write.h_event, 10000 )
                if result != winapi.WAIT_OBJECT_0:
                    # If the write times out make sure to
                    # cancel it, otherwise memory could
                    # get corrupted if the async write
                    # completes after this functions returns
                    winapi.CancelIo( int(self.hid_handle) )
                    raise HIDError("Write timed out")
            finally:
                # Make sure the event is closed so resources aren't leaked
                winapi.CloseHandle(over_write.h_event)
        else:
            return winapi.WriteFile(int(self.hid_handle), byref(raw_data),
                len(raw_data),
                None, None) #none overlapped
        return True
53283
def __send_buffer(self):
        
        bytes_written = self.serial.write(self.__out_buffer.raw)
        if self.DEBUG_MODE:
            print("Wrote: '{}'".format(binascii.hexlify(self.__out_buffer.raw)))
        if bytes_written != len(self.__out_buffer):
            raise IOError("{} bytes written for output buffer of size {}".format(bytes_written,
                                                                                 len(self.__out_buffer)))
        return bytes_written
769515
def send_stdin(io = nil)
      unless io.nil?
        begin
          send_chunk :stdin, io.read(2048)
        end until io.eof?
        io.close
      end
      send_chunk :stdin_eof
    end
511687
def output(stream):
    """"""
    while True:
        content = stream.read(1024)
        if len(content) == 0: break
        sys.stdout.write(content)
975009
def pipe_data_received(self, fd, data):
        """"""
        if fd == 2:  # stderr fd number
            self._on_stderr(data)
        elif self._on_data:
            self._on_data(data)
        else:
            self._queued_data.append(data)
639088
def write_bytes(self, data, n):
        """"""
        for pos in xrange(0, n):
            self.payload[self.pos + pos] = data[pos]
            
        self.pos += n
949875
function compressOutput(output, bw) {
  bw.writeVarint(output.value);
  compressScript(output.script, bw);
  return bw;
}
42898
def sendDAT(self):
        """"""
        finished = False
        blocknumber = self.context.next_block
        # Test hook
        if DELAY_BLOCK and DELAY_BLOCK == blocknumber:
            import time
            log.debug("Deliberately delaying 10 seconds...")
            time.sleep(10)
        dat = None
        blksize = self.context.getBlocksize()
        buffer = self.context.fileobj.read(blksize)
        log.debug("Read %d bytes into buffer", len(buffer))
        if len(buffer) < blksize:
            log.info("Reached EOF on file %s"
                % self.context.file_to_transfer)
            finished = True
        dat = TftpPacketDAT()
        dat.data = buffer
        dat.blocknumber = blocknumber
        self.context.metrics.bytes += len(dat.data)
        log.debug("Sending DAT packet %d", dat.blocknumber)
        self.context.sock.sendto(dat.encode().buffer,
                                 (self.context.host, self.context.tidport))
        if self.context.packethook:
            self.context.packethook(dat)
        self.context.last_pkt = dat
        return finished
830130
def send(self, data):
        
        self.stdin.write(data)
        self.stdin.flush()
329834
def _write_frame(self, data):
        """"""
        assert data is not None and 0 < len(data) < 255, 'Data must be array of 1 to 255 bytes.'
        # Build frame to send as:
        # - SPI data write (0x01)
        # - Preamble (0x00)
        # - Start code  (0x00, 0xFF)
        # - Command length (1 byte)
        # - Command length checksum
        # - Command bytes
        # - Checksum
        # - Postamble (0x00)
        length = len(data)
        frame = bytearray(length+8)
        frame[0] = PN532_SPI_DATAWRITE
        frame[1] = PN532_PREAMBLE
        frame[2] = PN532_STARTCODE1
        frame[3] = PN532_STARTCODE2
        frame[4] = length & 0xFF
        frame[5] = self._uint8_add(~length, 1)
        frame[6:-2] = data
        checksum = reduce(self._uint8_add, data, 0xFF)
        frame[-2] = ~checksum & 0xFF
        frame[-1] = PN532_POSTAMBLE
        # Send frame.
        logger.debug('Write frame: 0x{0}'.format(binascii.hexlify(frame)))
        self._gpio.set_low(self._cs)
        self._busy_wait_ms(2)
        self._spi.write(frame)
        self._gpio.set_high(self._cs)
1113718
def send(self, change):
        """"""
        self.buf.append(change)
        if len(self.buf) % self.BUF_SIZE == 0:
            self.flush()
312505
def _net_write(sock, data, expiration):
    
    current = 0
    l = len(data)
    while current < l:
        _wait_for_writable(sock, expiration)
        current += sock.send(data[current:])
23643
function send($data, $length = null) {
        if (!isset($this->pipes[0]))
            return 0;
        if (!isset($length))
            $length = strlen($data);
        return intval(fwrite($this->pipes[0], $data, $length));
    }
824358
def write_data(self, data, start_position=0):
		
		if len(data) > self.height():
			raise ValueError('Data too long (too many strings)')

		for i in range(len(data)):
			self.write_line(start_position + i, data[i])