Writes a raw string to the stream.

        @type   s: C{str}
        @param  s: The string data to be encoded to the AMF3 data stream.
542112
def serialiseString(self, s):
        
        if type(s) is unicode:
            s = self.context.getBytesForString(s)

        self.serialiseBytes(s)
445402
public static void writeString(String s, DataOutputStream out) throws IOException
    {
        out.writeInt(s.length());
        for (char c : s.toCharArray())
        {
            out.writeChar(c);
        }
    }
1066238
private void writeObject(java.io.ObjectOutputStream s)
            throws java.io.IOException {
        s.defaultWriteObject();

        // Write out size
        s.writeInt(size());

        // Write out elements in order.
        int mask = elements.length - 1;
        for (int i = head; i != tail; i = (i + 1) & mask)
            s.writeObject(elements[i]);
    }
103225
public static void writeStringAsText(DataOutput stream, String str) throws IOException {
    byte[] utf8Encoded = str.getBytes(StandardCharsets.UTF_8);
    writeVLong(stream, utf8Encoded.length);
    stream.write(utf8Encoded);
  }
351011
public void write(String s,int offset, int length)
        throws IOException
    {
        for (int i=0;i<length;i++)
            _buffer.append(s.charAt(offset+i));
    }
250066
def add_string(self, s):
        
        self.add_int(len(s))
        self.packet.write(s)
        return self
466981
public static void writeAsciiString(AsciiString s, DataOutput out) throws IOException {
        short length=(short)(s != null? s.length() : -1);
        out.writeShort(length);
        if(s != null)
            out.write(s.chars());
    }
412103
def add_string(self, s):
        
        s = asbytes(s)
        self.add_size(len(s))
        self.packet.write(s)
        return self
1095259
private void write(String s)
            throws SAXException {
        try {
            out.write(s);
            out.flush();
        } catch (IOException ioException) {
            throw new SAXParseException("I/O error",
                    documentLocator,
                    ioException);
        }
    }
746123
def writeAMF3(self, data):
        
        self.writeType(TYPE_AMF3)

        self.context.getAMF3Encoder(self).writeElement(data)
1143989
private void write(String s) {
    synchronized (document) {
      int offset = document.getLength();
      try {
        document.insertString(offset, s, attributes);
      } catch (BadLocationException e) {
        throw new UnexpectedException(e);
      }
    }
  }
250255
def writeString(self, str):
        
        ret = libxml2mod.xmlOutputBufferWriteString(self._o, str)
        return ret
529048
@Override
    public void write(String str) {
		int len = str.length();
		for (int i = 0; i < len; i++) {
			append(str.charAt(i));
		}
    }
1140799
def __write(self, s):
        
        self.buf += s
        while len(self.buf) > self.bufsize:
            self.fileobj.write(self.buf[:self.bufsize])
            self.buf = self.buf[self.bufsize:]
1100635
def write_longstr(self, s):
        
        self._flushbits()
        if isinstance(s, text_t):
            s = s.encode('utf-8')
        self.write_long(len(s))
        self.out.write(s)
242845
@Override
	public void writeBytes(String s)
    {
    	int len = s.length();
    	ensureCapacity(size+len);
    	for (int i = 0 ; i < len ; i++)
    	    buf[pos++] = (byte)s.charAt(i);
    }
    
	/* (non-Javadoc)
	 * @see java.io.DataOutput#writeChars(java.lang.String)
	 */
	@Override
	public void writeChars(String s)
	{
		int len = s.length();
		ensureCapacity(size+len*2);
        for (int i = 0 ; i < len ; i++) {
            int v = s.charAt(i);
            buf[pos++] = (byte)((v >>> 8) & 0xFF); 
            buf[pos++] = (byte)((v >>> 0) & 0xFF); 
        }
	}
    
    /*
     * (non-Javadoc)
     * @see java.io.DataOutput#write(byte[], int, int)
     */
    @Override
	public void write(byte[] data,int offset,int len)
    {
        int newCount = size+len; 
        ensureCapacity(newCount);
        System.arraycopy(data, offset, buf, size, len);
        size = newCount;
    }
    
    /*
     * (non-Javadoc)
     * @see java.io.DataOutput#writeByte(int)
     */
    @Override
	public void writeByte(int b)
    {
        ensureCapacity(size+1);
        buf[size++] = (byte)b;
    }
    
    /*
     * (non-Javadoc)
     * @see java.io.DataOutput#writeBoolean(boolean)
     */
    @Override
	public void writeBoolean(boolean v)
    {
        write(v ? 1 : 0);
    }
    
    /**
     * Read a byte value at an arbitrary position in the buffer
     * @param position the target position
     */
    public byte readByte(int position)
    {
    	return buf[position];
    }
    
    /**
     * Write a byte value at an arbitrary position in the buffer
     * @param v the byte value
     * @param position the target position
     */
    public void writeByte(byte v,int position)
    {
    	buf[position] = v;
    }
    
    /*
     * (non-Javadoc)
     * @see java.io.DataOutput#writeShort(int)
     */
    @Override
	public void writeShort(int v)
    {
        ensureCapacity(size + 2);
        buf[size++] = (byte)((v >>>  8) & 0xFF);
        buf[size++] = (byte)((v >>>  0) & 0xFF);
    }
    
    /*
     * (non-Javadoc)
     * @see java.io.DataOutput#writeInt(int)
     */
    @Override
	public void writeInt(int v)
    {
        ensureCapacity(size + 4);
        buf[size++] = (byte)((v >>> 24) & 0xFF);
        buf[size++] = (byte)((v >>> 16) & 0xFF);
        buf[size++] = (byte)((v >>>  8) & 0xFF);
        buf[size++] = (byte)((v >>>  0) & 0xFF);
    }
    
    /**
     * Write a int value at an arbitrary position in the stream
     * @param v the int value
     * @param pos the target position
     */
    public void writeInt(int v,int pos)
    {
        buf[pos++] = (byte)((v >>> 24) & 0xFF);
        buf[pos++] = (byte)((v >>> 16) & 0xFF);
        buf[pos++] = (byte)((v >>>  8) & 0xFF);
        buf[pos]   = (byte)((v >>>  0) & 0xFF);
    }
    
    /*
     * (non-Javadoc)
     * @see java.io.DataOutput#writeLong(long)
     */
    @Override
	public void writeLong(long v)
    {
        ensureCapacity(size + 8);
        buf[size++] = (byte)(v >>> 56);
        buf[size++] = (byte)(v >>> 48);
        buf[size++] = (byte)(v >>> 40);
        buf[size++] = (byte)(v >>> 32);
        buf[size++] = (byte)(v >>> 24);
        buf[size++] = (byte)(v >>> 16);
        buf[size++] = (byte)(v >>>  8);
        buf[size++] = (byte)(v >>>  0);
    }
    
    /*
     * (non-Javadoc)
     * @see java.io.DataOutput#writeFloat(float)
     */
    @Override
	public void writeFloat(float v)
    {
        writeInt(Float.floatToIntBits(v));
    }
    
    /*
     * (non-Javadoc)
     * @see java.io.DataOutput#writeDouble(double)
     */
    @Override
	public void writeDouble(double v)
    {
        writeLong(Double.doubleToLongBits(v));
    }
    
    /*
     * (non-Javadoc)
     * @see java.io.DataOutput#writeChar(int)
     */
    @Override
	public void writeChar(int v)
    {
        ensureCapacity(size + 2);
        buf[size++] = (byte)((v >>>  8) & 0xFF);
        buf[size++] = (byte)((v >>>  0) & 0xFF);
    }
    
    /*
     * (non-Javadoc)
     * @see java.io.DataOutput#writeUTF(java.lang.String)
     */
    @Override
	public void writeUTF(String str)
    {
        int strlen = str.length();
        if (strlen < 255)
            writeUTF(str,UTF_TYPE_1);
        else
        if (strlen < 65535)
            writeUTF(str,UTF_TYPE_2);
        else
            writeUTF(str,UTF_TYPE_4);
    }
    
    private void writeUTF( String str , byte type )
    {       
        // We need at least type + strlen bytes (1 byte/char) + 1
        int strlen = str.length();
        int rawlen = size+type+strlen+1;
        ensureCapacity(rawlen);
        
        // Write UTF type prefix
        buf[size++] = type;
        
        // Write the string length
        switch (type)
        {
            case UTF_TYPE_1 :
                buf[size++] = (byte)((strlen >>>  0) & 0xFF);
                break;
            case UTF_TYPE_2 :
                buf[size++] = (byte)((strlen >>>  8) & 0xFF);
                buf[size++] = (byte)((strlen >>>  0) & 0xFF);
                break;
            case UTF_TYPE_4 :
                buf[size++] = (byte)((strlen >>> 24) & 0xFF);
                buf[size++] = (byte)((strlen >>> 16) & 0xFF);
                buf[size++] = (byte)((strlen >>>  8) & 0xFF);
                buf[size++] = (byte)((strlen >>>  0) & 0xFF);
                break;
            default:
            	throw new IllegalArgumentException("Invalid UTF type : "+type);   
        }

        // Write the string
        int c,i = 0;
        for (i = 0 ; i < strlen ; i++)
        {
            c = str.charAt(i);
            if (!((c >= 0x0001) && (c <= 0x007F)))
                break;
            buf[size++] = (byte)c;
        }
        // Are we done ?
        if (i == strlen)
            return;

        // Fallback to full encoding mode
        for ( ; i < strlen ; i++)
        {
            c = str.charAt(i);

            if ((c >= 0x0001) && (c <= 0x007F))
            {
                // One byte
                buf[size++] = (byte)c;
            }
            else if (c > 0x07FF)
            {
                rawlen += 3;
                ensureCapacity(rawlen);
                
                buf[size++] = (byte)(0xE0 | ((c >> 12) & 0x0F));
                buf[size++] = (byte)(0x80 | ((c >> 6) & 0x3F));
                buf[size++] = (byte)(0x80 | ((c >> 0) & 0x3F));
            }
            else
            {
                rawlen += 2;
                ensureCapacity(rawlen);
                
                buf[size++] = (byte)(0xC0 | ((c >> 6) & 0x1F));
                buf[size++] = (byte)(0x80 | ((c >> 0) & 0x3F));
            }
        }
    }
1123286
protected void writeString(OutputStream out, String str) throws IOException {
        if (str == null) {
            writeInt(out, -1);
        } else if (str.isEmpty()) {
            writeInt(out, 0);
        } else {
            byte[] bs = StringSerializer.encode(str);
            writeInt(out, bs.length);
            out.write(bs);
        }
    }