Encodes and writes a single data element.

 @param [Element, Item, Sequence] element a data element
186587
def write_data_element(element)
      # Step 1: Write tag:
      write_tag(element.tag)
      # Step 2: Write [VR] and value length:
      write_vr_length(element.tag, element.vr, element.length)
      # Step 3: Write value (Insert the already encoded binary string):
      write_value(element.bin)
      check_encapsulated_image(element)
    end
215955
function (obj) {
            if (obj.data) {
                switch (obj.type) {
                    case 0:
                        this.segments.push('$saker_writeLiteral$("' + this.escape(obj.data) + '");');
                        break;
                    case 1:
                        this.segments.push('$saker_write$(' + obj.data + ');');
                        break;
                    case 2:
                        this.segments.push(obj.data);
                        break;
                }
            }
        }
475030
static void encode(DerOutputStream out, AlgorithmId algid, BitArray key)
        throws IOException {
            DerOutputStream tmp = new DerOutputStream();
            algid.encode(tmp);
            tmp.putUnalignedBitString(key);
            out.write(DerValue.tag_Sequence, tmp);
    }
1087047
function iterateWriteLinkedList () {
    if (!isIterating()) { return undefined; }

    let data = iterateData;
    let content = iterateData.item.content;

    data.item = data.item.next;

    if (data.item === null) {
        resetIterateData();

        writable.write(content, 'utf8', onWriteFinish);
    } else {
        writable.write(content, 'utf8', iterateWriteLinkedList);
    }
}
154674
protected void writeElementContent(char[] buf, int off, int len, Writer out) throws IOException {
		// esccape '<', '&', ']]>'
		final int end = off + len;
		int pos = off;
		for (int i = off; i < end; i++) {
			final char ch = buf[i];
			if (ch == ']') {
				if (seenBracket) {
					seenBracketBracket = true;
				} else {
					seenBracket = true;
				}
			} else {
				if (ch == '&') {
					if (i > pos) {
						out.write(buf, pos, i - pos);
					}
					out.write("&amp;");
					pos = i + 1;
				} else if (ch == '<') {
					if (i > pos) {
						out.write(buf, pos, i - pos);
					}
					out.write("&lt;");
					pos = i + 1;

				} else if (seenBracketBracket && ch == '>') {
					if (i > pos) {
						out.write(buf, pos, i - pos);
					}
					out.write("&gt;");
					pos = i + 1;
				} else if (ch < 32) {
					// in XML 1.0 only legal character are #x9 | #xA | #xD
					if (ch == 9 || ch == 10 || ch == 13) {
						// pass through

						// } else if(ch == 13 ) { //if(ch == '\r') {
						// if(i > pos) {
						// out.write(buf, pos, i - pos);
						// }
						// out.write("&#");
						// out.write(Integer.toString(ch));
						// out.write(';');
						// pos = i + 1;
					} else {
						if (TRACE_ESCAPING)
							System.err.println(getClass().getName() + " DEBUG TEXT value.len=" + len + " " + printable(new String(buf, off, len)));
						throw new IllegalStateException("character " + printable(ch) + " (" + Integer.toString(ch) + ") is not allowed in output" + getLocation());
						// in XML 1.1 legal are [#x1-#xD7FF]
						// if(ch > 0) {
						// if(i > pos) out.write(text.substring(pos, i));
						// out.write("&#");
						// out.write(Integer.toString(ch));
						// out.write(';');
						// pos = i + 1;
						// } else {
						// throw new IllegalStateException(
						// "character zero is not allowed in XML 1.1
						// output"+getLocation());
						// }
					}
				}
				if (seenBracket) {
					seenBracketBracket = seenBracket = false;
				}
				// assert seenBracketBracket == seenBracket == false;
			}
		}
		if (end > pos) {
			out.write(buf, pos, end - pos);
		}
	}
1199655
protected function writeElement($element): void
    {
        if (!is_array($element)) {
            $type = (is_object($element) ? get_class($element) . ' ' : '') . gettype($element);
            trigger_error("Unable to write to element to CSV stream; expect array, $type given", E_USER_WARNING);

            fwrite($this->stream, "\n");
            return;
        }

        fputcsv($this->stream, $element, $this->delimiter, $this->enclosure, $this->escapeChar);
    }
1289324
def write_elements(elements, mass_erase_used, progress=None):
    

    mem_layout = get_memory_layout(__dev)
    for elem in elements:
        addr = elem['addr']
        size = elem['size']
        data = elem['data']
        elem_size = size
        elem_addr = addr
        if progress:
            progress(elem_addr, 0, elem_size)
        while size > 0:
            write_size = size
            if not mass_erase_used:
                for segment in mem_layout:
                    if addr >= segment['addr'] and \
                       addr <= segment['last_addr']:
                        # We found the page containing the address we want to
                        # write, erase it
                        page_size = segment['page_size']
                        page_addr = addr & ~(page_size - 1)
                        if addr + write_size > page_addr + page_size:
                            write_size = page_addr + page_size - addr
                        page_erase(page_addr)
                        break
            write_memory(addr, data[:write_size], progress,
                         elem_addr, elem_size)
            data = data[write_size:]
            addr += write_size
            size -= write_size
            if progress:
                progress(elem_addr, addr - elem_addr, elem_size)
1074402
private String encode(Object element) {
    return BaseEncoding.base16().encode(elementSerializer.encode(element));
  }
190296
def write_member(self, data):
        
        if isinstance(data, basestring):
            self.write(data)
        else:
            for text in data:
                self.write(text)
        self.close_member()
626294
public void write(Writer out)
         throws IOException
    {
        for (int i=0; i <elements.size() ; i++)
        {
            Object element = elements.get(i);
          
            if (element instanceof Element)
                ((Element)element).write(out);
            else if (element==null)
                out.write("null");
            else 
                out.write(element.toString());
        }
    }
1070117
public void writeEndElement() throws XMLStreamException {
		try {
			this.checkPendingATEvents();
			encoder.encodeEndElement();
		} catch (Exception e) {
			throw new XMLStreamException(e.getLocalizedMessage(), e);
		}
	}
205055
def writeElement(self, data):
        
        key = type(data)
        func = None

        try:
            func = self._func_cache[key]
        except KeyError:
            func = self.getTypeFunc(data)

            if func is None:
                raise pyamf.EncodeError('Unable to encode %r (type %r)' % (
                    data, key))

            self._func_cache[key] = func

        func(data)
1214184
def write(self, outfile, encoding):
        
        try:
            handler = EscapeFriendlyXMLGenerator(outfile, encoding, short_empty_elements=True)
        except TypeError:  # Python 2
            handler = EscapeFriendlyXMLGenerator(outfile, encoding)
        handler.startDocument()
        handler.startElement('rss', self.rss_attributes())
        handler.startElement('channel', self.root_attributes())
        self.add_root_elements(handler)
        self.write_items(handler)
        self.endChannelElement(handler)
        handler.endElement('rss')
550036
protected function writeEl(XMLWriter $xml, $data)
    {
        foreach ($data as $key => $value) {
            if (\is_array($value) && !$this->isAssoc($value)) { //numeric array
                foreach ($value as $itemValue) {
                    if (\is_array($itemValue)) {
                        $xml->startElement($key);
                        $itemValue = $this->writeAttr($xml, $itemValue);
                        $this->writeEl($xml, $itemValue);
                        $xml->endElement();
                    } else {
                        $itemValue = $this->writeAttr($xml, $itemValue);
                        $xml->writeElement($key, "$itemValue");
                    }
                }
            } else if (\is_array($value)) { //associative array
                $xml->startElement($key);
                $value = $this->writeAttr($xml, $value);
                $this->writeEl($xml, $value);
                $xml->endElement();
            } else { //scalar
                $value = $this->writeAttr($xml, $value);
                $xml->writeElement($key, "$value");
            }
        }
    }
788118
def save(self, data, xparent=None):
        
        if xparent is not None:
            elem = ElementTree.SubElement(xparent, 'list')
        else:
            elem = ElementTree.Element('list')

        for item in data:
            XmlDataIO.toXml(item, elem)

        return elem
713446
void encode(ByteBuf out) {
        // Create optimised selector list and Huffman tables
        generateHuffmanOptimisationSeeds();
        for (int i = 3; i >= 0; i--) {
            optimiseSelectorsAndHuffmanTables(i == 0);
        }
        assignHuffmanCodeSymbols();

        // Write out the tables and the block data encoded with them
        writeSelectorsAndHuffmanTables(out);
        writeBlockData(out);
    }
1094844
@Override
    public void writeXML(XMLOutput xmlOutput) throws IOException {
        xmlOutput.openCloseTag(
                ELEMENT_NAME,
                new XMLAttributeList().addAttribute("sequence", String.valueOf(sequence))
                .addAttribute("timestamp", String.valueOf(timestamp)).addAttribute("release", releaseName)
                .addAttribute("codeSize", String.valueOf(codeSize))
                .addAttribute("numClasses", String.valueOf(numClasses)));
    }