Write an unsigned 32bit value at a specific position in the buffer.
        Used for writing tables and frames.
496839
def write_long_at(self, n, pos, pack_into=Struct('>I').pack_into):
        '''
        
        '''
        if 0 <= n <= 0xFFFFFFFF:
            pack_into(self._output_buffer, pos, n)
        else:
            raise ValueError('Long %d out of range 0..0xFFFFFFFF', n)
        return self
475812
public static int writeUnsignedInt(byte[] bytes, int offset, int i) {
      int localOffset = offset;
      while ((i & ~0x7F) != 0) {
         bytes[localOffset++] = (byte) ((i & 0x7f) | 0x80);
         i >>>= 7;
      }
      bytes[localOffset++] = (byte) i;
      return localOffset - offset;
   }
261208
public final static void writeMediumInt(ByteBuffer out, int value) {
        out.put((byte) ((value >>> 16) & 0xff));
        out.put((byte) ((value >>> 8) & 0xff));
        out.put((byte) (value & 0xff));
    }
1226830
public void writeByteBufferPart(byte[] buffer, int offset, int length)
        throws IOException
    {
        while (length > 0) {
            int sublen = length;

            if (0x8000 < sublen)
                sublen = 0x8000;

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

            os.write(buffer, offset, sublen);

            length -= sublen;
            offset += sublen;
        }
    }
255313
public static void writeLong(byte b[], int offset, long value) {
    b[offset++] = (byte) (value >>> 56);
    b[offset++] = (byte) (value >>> 48);
    b[offset++] = (byte) (value >>> 40);
    b[offset++] = (byte) (value >>> 32);
    b[offset++] = (byte) (value >>> 24);
    b[offset++] = (byte) (value >>> 16);
    b[offset++] = (byte) (value >>> 8);
    b[offset] = (byte)value;
  }
757381
private void writeShort(int s, byte[] buf, int offset) throws IOException {
        buf[offset] = (byte)(s & 0xff);
        buf[offset + 1] = (byte)((s >> 8) & 0xff);
    }
278035
public static void writeShort(byte b[], int offset, short value) {
    b[offset++] = (byte) (value >>> 8);
    b[offset] = (byte)value;
  }
1071791
public void writeBits(int b, int n) throws IOException {
		if (n <= capacity) {
			// all bits fit into the current buffer
			buffer = (buffer << n) | (b & (0xff >> (BITS_IN_BYTE - n)));
			capacity -= n;
			if (capacity == 0) {
				ostream.write(buffer);
				capacity = BITS_IN_BYTE;
				len++;
			}
		} else {
			// fill as many bits into buffer as possible
			buffer = (buffer << capacity)
					| ((b >>> (n - capacity)) & (0xff >> (BITS_IN_BYTE - capacity)));
			n -= capacity;
			ostream.write(buffer);
			len++;

			// possibly write whole bytes
			while (n >= 8) {
				n -= 8;
				ostream.write(b >>> n);
				len++;
			}

			// put the rest of bits into the buffer
			buffer = b; // Note: the high bits will be shifted out during
			// further filling
			capacity = BITS_IN_BYTE - n;
		}
	}
1025527
def append_little_endian32(self, unsigned_value):
        
        if not 0 <= unsigned_value <= wire_format.UINT32_MAX:
            raise errors.EncodeError(
                'Unsigned 32-bit out of range: %d' % unsigned_value)
        self.append_raw_bytes(struct.pack(
            wire_format.FORMAT_UINT32_LITTLE_ENDIAN, unsigned_value))
615110
def write(self, ulBuffer, pSrc, unBytes):
        """"""

        fn = self.function_table.write
        result = fn(ulBuffer, pSrc, unBytes)
        return result
427947
def write_short(self, n):
        
        if (n < 0) or (n > 65535):
            raise ValueError('Octet out of range 0..65535')
        self._flushbits()
        self.out.write(pack('>H', n))
774388
protected final void putInt32(long i32) {
        ensureCapacity(position + 4);

        byte[] buf = buffer;
        buf[position++] = (byte) (i32 & 0xff);
        buf[position++] = (byte) (i32 >>> 8);
        buf[position++] = (byte) (i32 >>> 16);
        buf[position++] = (byte) (i32 >>> 24);
    }
949552
public static void writeShort(byte[] bytes, short value, int offset) {
        bytes[offset] = (byte) (0xFF & (value >> 8));
        bytes[offset + 1] = (byte) (0xFF & value);
    }
1006547
public void
writeU32(long val) {
	check(val, 32);
	need(4);
	array[pos++] = (byte)((val >>> 24) & 0xFF);
	array[pos++] = (byte)((val >>> 16) & 0xFF);
	array[pos++] = (byte)((val >>> 8) & 0xFF);
	array[pos++] = (byte)(val & 0xFF);
}
1338125
function encodeUInt32(value) {
    let buffer = new ByteBuffer();
    if (value === null) {
        return buffer;
    }
    return buffer.writeVarint32(value);
}
377909
def write_frame(self, buf):
        '''
        
        '''
        writer = Writer(buf)
        writer.write_octet(self.type())
        writer.write_short(self.channel_id)

        # Track the position where we're going to write the total length
        # of the frame arguments.
        stream_args_len_pos = len(buf)
        writer.write_long(0)

        stream_method_pos = len(buf)

        writer.write_short(self._class_id)
        writer.write_short(self._weight)
        writer.write_longlong(self._size)

        # Like frame parsing, branch to faster code for default properties
        if self.DEFAULT_PROPERTIES:
            # Track the position where we're going to write the flags.
            flags_pos = len(buf)
            writer.write_short(0)
            flag_bits = 0
            for key, proptype, rfunc, wfunc, mask in self.PROPERTIES:
                val = self._properties.get(key, None)
                if val is not None:
                    flag_bits |= mask
                    wfunc(writer, val)
            writer.write_short_at(flag_bits, flags_pos)
        else:
            shift = 15
            flag_bits = 0
            flags = []
            stack = deque()
            for key, proptype, rfunc, wfunc, mask in self.PROPERTIES:
                val = self._properties.get(key, None)
                if val is not None:
                    if shift == 0:
                        flags.append(flag_bits)
                        flag_bits = 0
                        shift = 15

                    flag_bits |= (1 << shift)
                    stack.append((wfunc, val))

                shift -= 1

            flags.append(flag_bits)
            for flag_bits in flags:
                writer.write_short(flag_bits)
            for method, val in stack:
                method(writer, val)

        # Write the total length back at the beginning of the frame
        stream_len = len(buf) - stream_method_pos
        writer.write_long_at(stream_len, stream_args_len_pos)

        writer.write_octet(0xce)
372739
public void writeByteCurrentPosition(byte v) throws IOException {
    int index = (int)(position - bufferOffset);
    if (index < maxBufferSize) {
      buffer[index] = v;
      isByte[index] = true;
      if (index + 1 > currentBufferSize) currentBufferSize = index + 1;
      if (index + 1 >= maxBufferSize) {
        writeBuffer();
        newBuffer(position + 1);
      }
    } else {
      aFile.write(v);
    }
    position++;
  }