/** Creates a write stream to a CharBuffer. This is the standard way to write to a string. */
  public static WriteStream openWrite(CharBuffer cb) {
    com.caucho.vfs.StringWriter s = new com.caucho.vfs.StringWriter(cb);
    WriteStream os = new WriteStream(s);

    try {
      os.setEncoding("utf-8");
    } catch (Exception e) {
    }

    return os;
  }
  public static WriteStream openWrite(Writer writer) {
    ReaderWriterStream s = new ReaderWriterStream(null, writer);
    WriteStream os = new WriteStream(s);

    try {
      os.setEncoding("utf-8");
    } catch (Exception e) {
    }

    return os;
  }