Write encodes `n` at buf[head] using `packer_type`.
767265
def Write(packer_type, buf, head, n):
    
    packer_type.pack_into(buf, head, n)
415313
function( num, signed ) {
		var n = new Buffer(1);
		if (SAFE) { if (signed) {
			if (num < INT8_MIN) 
				throw new Errors.PackError('Packing number bigger than 8-bits ('+num+')!');
			else if (num > INT8_MAX) 
				throw new Errors.PackError('Packing number bigger than 8-bits ('+num+')!');
		} else {
			if (num < 0) throw  new Errors.PackError('Packing negative number on unsigned 8-bit ('+num+')!');
			else if (num > UINT8_MAX) 
				throw new Errors.PackError('Packing number bigger than 8-bits ('+num+')!');
		} }
		if (signed) packViewI8[0] = num;
		else packViewU8[0] = num;
		n[0] = packViewU8[0];
		return n;
	}
878146
def write_short(self, n, pack=Struct('>H').pack):
        
        if 0 <= n <= 0xFFFF:
            self._output_buffer.extend(pack(n))
        else:
            raise ValueError('Short %d out of range 0..0xFFFF', n)
        return self
875959
def write_hex(fout, buf, offset, width=16):
    

    skipped_zeroes = 0
    for i, chunk in enumerate(chunk_iter(buf, width)):
        # zero skipping
        if chunk == (b"\x00" * width):
            skipped_zeroes += 1
            continue
        elif skipped_zeroes != 0:
            fout.write("  -- skipped zeroes: {}\n".format(skipped_zeroes))
            skipped_zeroes = 0

        # starting address of the current line
        fout.write("{:016x}  ".format(i * width + offset))

        # bytes column
        column = "  ".join([" ".join(["{:02x}".format(c) for c in subchunk])
                            for subchunk in chunk_iter(chunk, 8)])
        w = width * 2 + (width - 1) + ((width // 8) - 1)
        if len(column) != w:
            column += " " * (w - len(column))
        fout.write(column)

        # ASCII character column
        fout.write("  |")
        for c in chunk:
            if c in PRINTABLE_CHARS:
                fout.write(chr(c))
            else:
                fout.write(".")
        if len(chunk) < width:
            fout.write(" " * (width - len(chunk)))
        fout.write("|")

        fout.write("\n")
1351487
def safe_write(buf):
    """"""
    assert isinstance(buf, bytes)
    while True:
        try:
            os.write(1, buf)
            break
        except IOError as e:
            if e.errno != errno.EINTR:
                raise
1053631
def add_int(self, n):
        
        self.packet.write(struct.pack('>I', n))
        return self
1220590
public void writeBytes(byte[] buffer, int offset, int length)
        throws IOException
    {
        if (buffer == null) {
            os.write('N');
        }
        else {
            while (length > 0x8000) {
                int sublen = 0x8000;

                os.write('b');
                os.write(sublen >> 8);
                os.write(sublen);

                os.write(buffer, offset, sublen);

                length -= sublen;
                offset += sublen;
            }

            os.write('B');
            os.write(length >> 8);
            os.write(length);
            os.write(buffer, offset, length);
        }
    }
926663
def add_size(self, n):
        
        self.packet.write(struct.pack('>I', n))
        return self
512551
function( num ) {
		var n = new Buffer(4);
		if (SAFE) { if (num == 0.0) { }
		else if ((Math.abs(num) < FLOAT32_SMALL) || (num < FLOAT32_NEG) || (num > FLOAT32_POS)) 
			throw new Errors.PackError('Packing float bigger than 32-bits ('+num+')!');
		}
		packViewF32[0] = num;
		for (var i=0; i<4; ++i) n[i]=packViewU8[i];
		return n;
	}
278187
def encode(self, value):
        '''
        
        '''
        packed = pack(self.fmt, value)
        return Bits(bytes=packed)
345615
def write_memory(self, addr, value, transfer_size=32):
        
        self.ap.write_memory(addr, value, transfer_size)
582937
@Override
    public void encode(final OtpOutputStream buf) {
        final int arity = elems.length;

        buf.write_tuple_head(arity);

        for (int i = 0; i < arity; i++) {
            buf.write_any(elems[i]);
        }
    }
220334
def writeByte(self, byte):
        
        self.data.write(pack("B" if not self.signed else "b", byte))
257551
function encodeArray_NUM_SHORT( encoder, data, n_type ) {

	//
	// Short Numeric Array (NUM_SHORT)
	//
	// .....  ...
	// 01110 [TYPE]
	//

	encoder.counters.arr_num_short+=1;
	encoder.log(LOG.ARR, "array.numeric.short, len="+data.length+
		", type="+_NUMTYPE[n_type]+" ("+n_type+")");

	// Encode primitives one after the other
	encoder.stream8.write( pack1b( ARR_OP.NUM_SHORT | n_type ) );
	encoder.stream8.write( pack1b( data.length, false ) );
	encoder.counters.arr_hdr+=2;

	// Encode the short array
	pickStream( encoder, n_type )
		.write( packTypedArray( convertArray( data, n_type ) ) );

}
249718
def write_octet(self, n, pack=Struct('B').pack):
        
        if 0 <= n <= 255:
            self._output_buffer.append(pack(n))
        else:
            raise ValueError('Octet %d out of range 0..255', n)
        return self
318125
def writeNumber(self, n):
        
        self.writeType(TYPE_NUMBER)
        self.stream.write_double(float(n))
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));
    }