Serialize object.

        Raises:
            Exception: if hash writing fails.

        Args:
            writer (neo.IO.BinaryWriter):
354539
def Serialize(self, writer):
        
        try:
            writer.WriteByte(self.Type)
            writer.WriteHashes(self.Hashes)
        except Exception as e:
            logger.error(f"COULD NOT WRITE INVENTORY HASHES ({self.Type} {self.Hashes}) {e}")
1054085
def writer(self, outputs, stdout, stderr=sys.stderr):
        
        for output in outputs:
            try:
                output = flatten(output)
                if self.data_interchange_format == "json":
                    # Only dump one json string, and skip another one, maybe key or value.
                    output = filter(lambda x: x, output)
                else:
                    # JSON is already serialized, so we put `self.serialize` in a else statement.
                    output = map(self.serialize, output)
                print("\t".join(output), file=stdout)
            except BaseException:
                print(output, file=stderr)
                raise
995773
def _writer(self):
        
        while not self.closed:
            try:
                sock, data = self._write_queue.get(timeout=0.1)
                self._write_queue.task_done()
                sock.send(data)
            except Empty:
                pass  # nothing to write after timeout
            except socket.error as err:
                if err.errno == errno.EBADF:
                    self._clean_dead_sessions()
1298199
def Serialize(self, writer):
        
        writer.WriteUInt32(self.Timestamp)
        writer.WriteUInt64(self.Services)
        # turn ip address into bytes
        octets = bytearray(map(lambda oct: int(oct), self.Address.split('.')))
        # pad to fixed length 16
        octets += bytearray(12)
        # and finally write to stream
        writer.WriteBytes(octets)
        writer.WriteUInt16(self.Port, endian='>')
1158293
def Serialize(self, writer):
        
        self.SerializeUnsigned(writer)
        writer.WriteByte(1)
        self.Script.Serialize(writer)
998784
def write (self, s):
        
        if isinstance(s, bytes):
            s = self._decode(s)
        for c in s:
            self.process(c)
341951
def Serialize(self, writer):
        
        self.SerializeUnsigned(writer)
        writer.WriteSerializableArray(self.scripts)
1037851
function xmlSerialize(Writer $writer) {
        $writer->write([
           Schema::CBC.'Description' => $this->description,
           Schema::CBC.'Name' => $this->name,
           Schema::CAC.'SellersItemIdentification' => [
               Schema::CBC.'ID' => $this->sellersItemIdentification
           ],
        ]);
    }
1139109
public void writeHeader(Writer writer) 
        throws IOException
    {
        if (_state!=__MSG_EDITABLE)
            throw new IllegalStateException(__state[_state]+
                                            " is not EDITABLE");
        if (_header==null)
            throw new IllegalStateException("Response is destroyed");

        if (getHttpRequest().getDotVersion()>=0)
        {
            _state=__MSG_BAD;
            writer.write(_version);
            writer.write(' ');
            writer.write('0'+((_status/100)%10));
            writer.write('0'+((_status/10)%10));
            writer.write('0'+(_status%10));
            writer.write(' ');
            writer.write(getReason());
            writer.write(HttpFields.__CRLF);
            _header.write(writer);
        }
        _state=__MSG_SENDING;
    }
1174166
def WriteHashes(self, arr):
        
        length = len(arr)
        self.WriteVarInt(length)
        for item in arr:
            ba = bytearray(binascii.unhexlify(item))
            ba.reverse()
            #            logger.info("WRITING HASH %s " % ba)
            self.WriteBytes(ba)
906808
def write(self, s):
        
        if not self.isalive():
            raise EOFError('Pty is closed')
        if PY2:
            s = _unicode(s)

        success, nbytes = self.pty.write(s)
        if not success:
            raise IOError('Write failed')
        return nbytes
259982
function xmlSerialize(Writer $writer) {
        $writer->write([
            [
                'name' => Schema::CBC.'PriceAmount',
                'value' => $this->priceAmount,
                'attributes' => [
                    'currencyID' => Generator::$currencyID
                ]
            ],
            [
                'name' => Schema::CBC.'BaseQuantity',
                'value' => $this->baseQuantity,
                'attributes' => [
                    'unitCode' => $this->unitCode
                ]
            ]

        ]);
    }
583596
def Serialize(self, writer):
        
        writer.WriteVarBytes(self.Script)
        writer.WriteVarBytes(self.ParameterList)
        writer.WriteByte(self.ReturnType)
293082
public Writer write(Writer writer) throws JSONException {
    try {
      boolean b = false;
      int len = length();

      writer.write('[');

      for (int i = 0; i < len; i += 1) {
        if (b) {
          writer.write(',');
        }
        Object v = this.myArrayList.get(i);
        if (v instanceof JSONObject) {
          ((JSONObject) v).write(writer);
        } else if (v instanceof JSONArray) {
          ((JSONArray) v).write(writer);
        } else {
          writer.write(JSONObject.valueToString(v));
        }
        b = true;
      }
      writer.write(']');
      return writer;
    } catch (IOException e) {
      throw new JSONException(e);
    }
  }
87521
public void write(PrintWriter writer) {
        this.output = writer;
        dispatch(base, false);
        writer.flush();
    }
377038
def Serialize(self, writer):
        
        writer.WriteVarString(self.name)
        writer.WriteVarString(self.symbol)
        writer.WriteUInt8(self.decimals)
37856
public static void toWriter(Node node, Writer writer) throws TransformerException {
		toWriter(node, writer, new HashMap<String, String>());
	}