System.Byte

Here are the examples of the python api System.Byte taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

3 Examples 7

Example 1

Project: spiderfoot Source File: filters.py
    def _read_bytes(stream):
        ms = IO.MemoryStream()
        buf = Array.CreateInstance(System.Byte, 2048)
        while True:
            bytes = stream.Read(buf, 0, buf.Length)
            if bytes == 0:
                break
            else:
                ms.Write(buf, 0, bytes)
        retval = ms.ToArray()
        ms.Close()
        return retval

Example 2

Project: spiderfoot Source File: filters.py
    def _string_to_bytearr(buf):
        retval = Array.CreateInstance(System.Byte, len(buf))
        for i in range(len(buf)):
            retval[i] = ord(buf[i])
        return retval

Example 3

Project: ironpython3 Source File: cominterop_util.py
def overflowErrorTrigger(in_type):
    ret_val = {}
    
    ############################################################
    ret_val["VARIANT_BOOL"] =  []
                     
    ############################################################              
    ret_val["BYTE"] = []
    ret_val["BYTE"] += overflow_num_helper(System.Byte)
        
    ############################################################
    #Doesn't seem possible to create a value (w/o 1st overflowing
    #in Python) to pass to the COM method which will overflow.
    ret_val["BSTR"] = [] #["0123456789" * 1234567890]
    
    ############################################################ 
    ret_val["CHAR"] = []
    ret_val["CHAR"] +=  overflow_num_helper(System.SByte)
    
    ############################################################
    ret_val["FLOAT"] = []  
    ret_val["FLOAT"] += overflow_num_helper(System.Double)
    
    #Shouldn't be possible to overflow a double.
    ret_val["DOUBLE"] =  []
    
    
    ############################################################            
    ret_val["USHORT"] =  []
    ret_val["USHORT"] += overflow_num_helper(System.UInt16)
      
    ret_val["ULONG"] =  []
    ret_val["ULONG"] +=  overflow_num_helper(System.UInt32)
               
    ret_val["ULONGLONG"] =  []
    # Dev10 475426
    #ret_val["ULONGLONG"] +=  overflow_num_helper(System.UInt64)
      
    ret_val["SHORT"] =  []
    ret_val["SHORT"] += overflow_num_helper(System.Int16)
      
    ret_val["LONG"] =  []
    # Dev10 475426
    #ret_val["LONG"] += overflow_num_helper(System.Int32)
                
    ret_val["LONGLONG"] =  []
    # Dev10 475426
    #ret_val["LONGLONG"] += overflow_num_helper(System.Int64)
    
    ############################################################
    return ret_val[in_type]