Write a UInt160 type to the stream.

        Args:
            value (UInt160):

        Raises:
            Exception: when `value` is not of neocore.UInt160 type.
971706
def WriteUInt160(self, value):
        
        if type(value) is UInt160:
            value.Serialize(self)
        else:
            raise Exception("value must be UInt160 instance ")
318125
def writeNumber(self, n):
        
        self.writeType(TYPE_NUMBER)
        self.stream.write_double(float(n))
65315
def write(self, value):
        
        if hasattr(value, '__iter__'):
            bytearray(value)
            self.extend(value)
        else:
            bytearray([value])
            self.append(value)
1013253
def append_var_uint64(self, unsigned_value):
        
        if not 0 <= unsigned_value <= wire_format.UINT64_MAX:
            raise errors.EncodeError('Value out of range: %d' % unsigned_value)
        while True:
            bits = unsigned_value & 0x7f
            unsigned_value >>= 7
            if unsigned_value:
                bits |= 0x80
            self._buffer.append(bits)
            if not unsigned_value:
                break
345122
def value(self, value):
        
        try:
            struct.pack('>' + conf.TYPE_CHAR, value)
        except struct.error:
            raise IllegalDataValueError

        self._value = value
419704
public void write1Bit(int value) throws IOException {
        Debug.print(value);
        if (curBit == 8) {
            curBit = 0;
            writeCurByte();
        }
        curByte[curBit++] = value;
    }
124954
public static void writeUnsignedIntegerLittleEndian(IO.WritableByteStream io, long value) throws IOException {
		io.write((byte)(value & 0xFF));
		io.write((byte)((value >> 8) & 0xFF));
		io.write((byte)((value >> 16) & 0xFF));
		io.write((byte)((value >> 24) & 0xFF));
	}
606831
def encode(cls, value):
        
        coerced = unicode(value)
        if coerced == value and cls.PATTERN.match(coerced):
            return coerced.encode(cls._encoding)

        raise InvalidValue('not ascii')
59463
def to_bytes(value):
    
    vtype = type(value)

    if vtype == bytes or vtype == type(None):
        return value

    try:
        return vtype.encode(value)
    except UnicodeEncodeError:
        pass
    return value
898815
def set(self, value):
        

        if not isinstance(value, int_types):
            raise TypeError(unwrap(
                '''
                %s value must be an integer, not %s
                ''',
                type_name(self),
                type_name(value)
            ))

        self._native = value
        self.contents = int_to_bytes(value, signed=False)
        self._header = None
        if self._indefinite:
            self._indefinite = False
            self.method = 0
        if self._trailer != b'':
            self._trailer = b''
1291375
protected void _writeSimpleObject(Object value) throws IOException, JsonGenerationException {
	    /* 31-Dec-2009, tatu: Actually, we could just handle some basic
	     *    types even without codec. This can improve interoperability,
	     *    and specifically help with TokenBuffer.
	     */
	    if (value == null) {
	        writeNull();
	        return;
	    }
	    if (value instanceof String) {
	        writeString((String) value);
	        return;
	    }
	    if (value instanceof Number) {
	        Number n = (Number) value;
	        if (n instanceof Integer) {
	            writeNumber(n.intValue());
	            return;
	        } else if (n instanceof Long) {
	            writeNumber(n.longValue());
	            return;
	        } else if (n instanceof Double) {
	            writeNumber(n.doubleValue());
	            return;
	        } else if (n instanceof Float) {
	            writeNumber(n.floatValue());
	            return;
	        } else if (n instanceof Short) {
	            writeNumber(n.shortValue());
	            return;
	        } else if (n instanceof Byte) {
	            writeNumber(n.byteValue());
	            return;
	        } else if (n instanceof BigInteger) {
	            writeNumber((BigInteger) n);
	            return;
	        } else if (n instanceof BigDecimal) {
	            writeNumber((BigDecimal) n);
	            return;
	            
	        // then Atomic types
	            
	        } else if (n instanceof AtomicInteger) {
	            writeNumber(((AtomicInteger) n).get());
	            return;
	        } else if (n instanceof AtomicLong) {
	            writeNumber(((AtomicLong) n).get());
	            return;
	        }
	    } else if (value instanceof Boolean) {
	        writeBoolean(((Boolean) value).booleanValue());
	        return;
	    } else if (value instanceof AtomicBoolean) {
	        writeBoolean(((AtomicBoolean) value).get());
	        return;
	    }
	    throw new IllegalStateException("No ObjectCodec defined for the generator, can only serialize simple wrapper types (type passed "
	            +value.getClass().getName()+")");
	}
1195536
def encode(self, value):
        
        if self.decode_responses and isinstance(value, bytes):
            value = value.decode(self.encoding)
        elif not self.decode_responses and isinstance(value, str):
            value = value.encode(self.encoding)
        return value
240691
def _cast_value(value, _type):
    
    if _type.upper() == 'FLOAT64':
        return float64(value)
    elif _type.upper() == 'FLOAT32':
        return float32(value)
    elif _type.upper() == 'INT32':
        return int32(value)
    elif _type.upper() == 'UINT16':
        return uint16(value)
    elif _type.upper() == 'INT16':
        return int16(value)
    elif _type.upper() == 'BOOLEAN':
        return uint8(value)
    else:
        return float64(value)
1255727
function UInt16Le(value, opt) {
	SingleType.call(this, value, 2, Buffer.prototype.readUInt16LE, Buffer.prototype.writeUInt16LE, opt);
}
33014
def _send_byte(self,value):
        

        # Coerce to int. This will throw a ValueError if the value can't
        # actually be converted.
        if type(value) != int:
            new_value = int(value)

            if self.give_warnings:
                w = "Coercing {} into int ({})".format(value,new_value)
                warnings.warn(w,Warning)
                value = new_value

        # Range check
        if value > 255 or value < 0:
            err = "Value {} exceeds the size of the board's byte.".format(value)
            raise OverflowError(err)

        return struct.pack("B",value)
454653
def _send_unsigned_int(self,value):
        
        # Coerce to int. This will throw a ValueError if the value can't 
        # actually be converted.
        if type(value) != int:
            new_value = int(value)

            if self.give_warnings:
                w = "Coercing {} into int ({})".format(value,new_value)
                warnings.warn(w,Warning)
                value = new_value

        # Range check
        if value > self.board.unsigned_int_max or value < self.board.unsigned_int_min:
            err = "Value {} exceeds the size of the board's unsigned int.".format(value)
            raise OverflowError(err)
           
        return struct.pack(self.board.unsigned_int_type,value)
256551
def write_byte(self, value):
        
        if isinstance(value, bytes):
            self.stream.write(value)
        elif isinstance(value, str):
            self.stream.write(value.encode('utf-8'))
        elif isinstance(value, int):
            self.stream.write(bytes([value]))