Prints a string to the stream, encoded as UTF-8

@param v the string to print.
485413
public void printString(String v, int offset, int length)
        throws IOException
    {
        for (int i = 0; i < length; i++) {
            char ch = v.charAt(i + offset);

            if (ch < 0x80)
                os.write(ch);
            else if (ch < 0x800) {
                os.write(0xc0 + ((ch >> 6) & 0x1f));
                os.write(0x80 + (ch & 0x3f));
            }
            else {
                os.write(0xe0 + ((ch >> 12) & 0xf));
                os.write(0x80 + ((ch >> 6) & 0x3f));
                os.write(0x80 + (ch & 0x3f));
            }
        }
    }
368456
@Override
	public Utf8 readString(Utf8 old) throws IOException {
		int length = readInt();
		Utf8 result = (old != null ? old : new Utf8());
		result.setByteLength(length);
		
		if (length > 0) {
			in.readFully(result.getBytes(), 0, length);
		}
		
		return result;
	}
753247
@Override
	public void writeInt(int v) throws IOException {
		outputStream.write(0xFF & v);
		outputStream.write(0xFF & (v >> 8));
		outputStream.write(0xFF & (v >> 16));
		outputStream.write(0xFF & (v >> 24));
		bytesWritten += 4;
	}
595364
private void writeSimpleString(OutputStream out, CharSequence value) throws IOException {
        out.write('"');
        for (int i = 0; i < value.length(); i++) {
            out.write(value.charAt(i));
        }
        out.write('"');
    }
744129
public void print(String value) throws IOException
  {
    if(value!=null) {
        this.output.write(value.getBytes(), 0, value.length());        
    }
  }
464022
public void setEncoding(String v) {
    if (SourceFile_Type.featOkTst && ((SourceFile_Type)jcasType).casFeat_encoding == null)
      jcasType.jcas.throwFeatMissing("encoding", "de.julielab.jules.types.ace.SourceFile");
    jcasType.ll_cas.ll_setStringValue(addr, ((SourceFile_Type)jcasType).casFeatCode_encoding, v);}
1090178
@Override
	public void writeString(String str) throws IOException {
		byte[] bytes = Utf8.getBytesFor(str);
		writeBytes(bytes, 0, bytes.length);
	}
325881
@Override
    public void print(String s) throws IOException {
        //TODO this is wrong for encoding
        byte[] data = (null == s) ? "null".getBytes() : s.getBytes();
        this.output.write(data, 0, data.length);
    }
745516
@Override
  public void write(TextWriterStream out, String label, int[] v) {
    StringBuilder buf = new StringBuilder();
    if(label != null) {
      buf.append(label).append('=');
    }
    if(v != null) {
      FormatUtil.formatTo(buf, v, " ");
    }
    out.inlinePrintNoQuotes(buf.toString());
  }
449553
private static String inputStreamToString(InputStream in, String encoding) throws IOException {

        ByteArrayOutputStream outStream = new ByteArrayOutputStream();
        byte[] data = new byte[BUFFER_SIZE];
        int count = -1;
        while ((count = in.read(data, 0, BUFFER_SIZE)) != -1) {
            outStream.write(data, 0, count);
        }
        return new String(outStream.toByteArray(), encoding);
    }
169839
def decode_string(v, encoding="utf-8"):
    """"""
    if isinstance(encoding, basestring):
        encoding = ((encoding,),) + (("windows-1252",), ("utf-8", "ignore"))
    if isinstance(v, binary_type):
        for e in encoding:
            try:
                return v.decode(*e)
            except:
                pass
        return v
    return unicode(v)
267481
public PrintWriter pw(OutputStream o) {
    String encoding = outputEncoding;
    if (!java.nio.charset.Charset.isSupported(encoding)) {
      System.out.println("Warning: desired encoding " + encoding + " not accepted. ");
      System.out.println("Using UTF-8 to construct PrintWriter");
      encoding = "UTF-8";
    }

    try {
      return new PrintWriter(new OutputStreamWriter(o, encoding), true);
    } catch (UnsupportedEncodingException e) {
      System.out.println("Warning: desired encoding " + outputEncoding + " not accepted. " + e);
      try {
        return new PrintWriter(new OutputStreamWriter(o, "UTF-8"), true);
      } catch (UnsupportedEncodingException e1) {
        System.out.println("Something is really wrong.  Your system doesn't even support UTF-8!" + e1);
        return new PrintWriter(o, true);
      }
    }
  }
101352
public void writeLength(int v) throws IOException {
		
		if (v == Tag.Indefinite_Length) {
			
			this.write(0x80);
			return;
		} else if (v > 0x7F) {
            int count;
            byte[] buf = new byte[4];
            if ((v & 0xFF000000) > 0) {
                buf[0] = (byte)((v >> 24) & 0xFF);
                buf[1] = (byte)((v >> 16) & 0xFF);
                buf[2] = (byte)((v >> 8) & 0xFF);
                buf[3] = (byte)(v & 0xFF);
                count = 4;
            } else if ((v & 0x00FF0000) > 0) {
                buf[0] = (byte)((v >> 16) & 0xFF);
                buf[1] = (byte)((v >> 8) & 0xFF);
                buf[2] = (byte)(v & 0xFF);
                count = 3;
            } else if ((v & 0x0000FF00) > 0) {
                buf[0] = (byte)((v >> 8) & 0xFF);
                buf[1] = (byte)(v & 0xFF);
                count = 2;
            } else {
                buf[0] = (byte)(v & 0xFF);
                count = 1;
            }

            this.buffer[pos] = (byte) (0x80 | count);
            for (int i1 = 0; i1 < count; i1++) {
                this.buffer[pos + i1 + 1] = buf[i1];
            }
            this.pos += count + 1;

//			int posLen = this.pos;
//			this.write(0);
//			int count = this.writeIntegerData(v);
//			this.buffer[posLen] = (byte) (count | 0x80);
		} else { // short
			
			this.write(v);
		}
	}
1187382
public WrappedByteBuffer putString(String v, Charset cs) {
        java.nio.ByteBuffer strBuf = cs.encode(v);
        _autoExpand(strBuf.limit());
        _buf.put(strBuf);
        return this;
    }
858301
public static Writer getOutputStreamWriter(OutputStream out) {
    try {
      return new OutputStreamWriter(out, "UTF-8");
    }
    catch (UnsupportedEncodingException ex) {
      throw new RuntimeException(ex); // shouldn't happen since UTF-8 is supported by all JVMs per spec
    }
  }
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);
  }
1244666
public static void writeUTF8WithLength(OutputStream out, String str) throws IOException {
        byte[] s = str.getBytes(UTF8);
        writeInt4(out, s.length);
        out.write(s);
    }