Writes an unsigned integer to the packet
423790
def write_int(self, value):
        """"""
        format = '!I'
        self.data.append(struct.pack(format, int(value)))
        self.size += 4
1193844
def packet_write(self):
        """"""
        bytes_written = 0
        
        if self.sock == NC.INVALID_SOCKET:
            return NC.ERR_NO_CONN, bytes_written
        
        while len(self.out_packet) > 0:
            pkt = self.out_packet[0]
            write_length, status = nyamuk_net.write(self.sock, pkt.payload)
            if write_length > 0:
                pkt.to_process -= write_length
                pkt.pos += write_length
                
                bytes_written += write_length
                
                if pkt.to_process > 0:
                    return NC.ERR_SUCCESS, bytes_written
            else:
                if status == errno.EAGAIN or status == errno.EWOULDBLOCK:
                    return NC.ERR_SUCCESS, bytes_written
                elif status == errno.ECONNRESET:
                    return NC.ERR_CONN_LOST, bytes_written
                else:
                    return NC.ERR_UNKNOWN, bytes_written
            
            """
            if pkt.command & 0xF6 == NC.CMD_PUBLISH and self.on_publish is not None:
                self.in_callback = True
                self.on_publish(pkt.mid)
                self.in_callback = False
            """
            
            #next
            del self.out_packet[0]
            
            #free data (unnecessary)
            
            self.last_msg_out = time.time()
            
        
        return NC.ERR_SUCCESS, bytes_written
718032
def write(self, fptr):
        
        num_uuids = len(self.ulst)
        length = 4 + 4 + 2 + num_uuids * 16
        write_buffer = struct.pack('>I4sH', length, b'ulst', num_uuids)
        fptr.write(write_buffer)

        for j in range(num_uuids):
            fptr.write(self.ulst[j].bytes)
639088
def write_bytes(self, data, n):
        """"""
        for pos in xrange(0, n):
            self.payload[self.pos + pos] = data[pos]
            
        self.pos += n
931991
public static void writeInt(byte[] buf, int pos, int v) {
    checkBoundary(buf, pos, 4);
    buf[pos++] = (byte) (0xff & (v >> 24));
    buf[pos++] = (byte) (0xff & (v >> 16));
    buf[pos++] = (byte) (0xff & (v >> 8));
    buf[pos] = (byte) (0xff & v);
  }
1215869
public void writeInt(int pInt) throws IOException {
        out.write(pInt & 0xFF);
        out.write((pInt >>> 8) & 0xFF);
        out.write((pInt >>> 16) & 0xFF);
        out.write((pInt >>> 24) & 0xFF);
        bytesWritten += 4;

    }
1369512
def write_uint32(self, value, little_endian=True):
        
        if little_endian:
            endian = "<"
        else:
            endian = ">"
        return self.pack('%sI' % endian, value)
451057
public static void writeInt(byte[] b, int offset, int value) {
    b[offset++] = (byte) (value >>> 24);
    b[offset++] = (byte) (value >>> 16);
    b[offset++] = (byte) (value >>> 8);
    b[offset] = (byte)value;
  }
111460
def write_byte(self, value):
        """"""
        format = '!B'
        self.data.append(struct.pack(format, value))
        self.size += 1
348122
def write(self, data):
        
        data_off = 0
        while data_off < len(data):
            left = len(self._buf) - self._pos
            if left <= 0:
                self._write_packet(final=False)
            else:
                to_write = min(left, len(data) - data_off)
                self._buf[self._pos:self._pos + to_write] = data[data_off:data_off + to_write]
                self._pos += to_write
                data_off += to_write
1057200
def write_int32(self, value, little_endian=True):
        
        if little_endian:
            endian = "<"
        else:
            endian = ">"
        return self.pack('%si' % endian, value)
458530
void writeInt(int value) throws IOException {
        if (value < MIN_FIX_INT) {
            // large negative
            if (value >= Byte.MIN_VALUE) {
                output.writeByte(SINT_8);
                output.writeByte((byte) value);
            } else if (value >= Short.MIN_VALUE) {
                output.writeByte(SINT_16);
                output.writeShort((short) value);
            } else {
                output.writeByte(SINT_32);
                output.writeInt(value);
            }
        } else if (value < MAX_FIX_INT) {
            // in range -64 to 127
            output.writeByte(value);
        } else {
            // large positive
            if (value < 0xFF) {
                output.writeByte(UINT_8);
                output.writeByte((byte) value);
            } else if (value < 0xFFFF) {
                output.writeByte(UINT_16);
                output.writeShort((short) value);
            } else {
                output.writeByte(UINT_32);
                output.writeInt(value);
            }
        }
    }
1157037
public void writeBit(int value, int number) throws IOException {
    int localNumber = number;
    while (localNumber > 0) {
      localNumber--;
      bitBuffer |= ((value & 1) << bitCount++);
      if (bitCount == 8) {
        createByte();
      }
    }
  }
638283
def send_pgrp(cls, sock, pgrp):
    """"""
    assert(isinstance(pgrp, IntegerForPid) and pgrp < 0)
    encoded_int = cls.encode_int(pgrp)
    cls.write_chunk(sock, ChunkType.PGRP, encoded_int)
387048
def write_packets(self):
        """"""
        while self.running:
            if len(self.write_queue) > 0:
                self.write_queue[0].send(self.client)
                self.write_queue.pop(0)
785430
def write_raw_byte(self, value):
        
        self.bus.write_byte(self.address, value)
        self.log.debug("write_raw_byte: Wrote 0x%02X" % value)
994007
public static void writeInt(int num, ByteBuffer buf) {
        if(num == 0) {
            buf.put((byte)0);
            return;
        }
        final byte bytes_needed=bytesRequiredFor(num);
        buf.put(bytes_needed);
        for(int i=0; i < bytes_needed; i++)
            buf.put(getByteAt(num, i));
    }