========================================================================= Write
180990
function(zip, model) {
    return PromishLib.Promish.all(model.media.map(function(medium) {
      if (medium.type === 'image') {
        var filename = 'xl/media/' + medium.name + '.' + medium.extension;
        if (medium.filename) {
          return fsReadFileAsync(medium.filename)
            .then(function(data) {
              zip.append(data, {name: filename});
            });
        }
        if (medium.buffer) {
          return new PromishLib.Promish(function(resolve) {
            zip.append(medium.buffer, {name: filename});
            resolve();
          });
        }
        if (medium.base64) {
          return new PromishLib.Promish(function(resolve) {
            var dataimg64 = medium.base64;
            var content = dataimg64.substring(dataimg64.indexOf(',') + 1);
            zip.append(content, { name: filename, base64: true });
            resolve();
          });
        }
      }
      return PromishLib.Promish.reject(new Error('Unsupported media'));
    }));
  }
1275889
private void writeEscaped(String in)
		throws IOException
	{
		for(int i=0, n=in.length(); i<n; i++)
		{
			char c = in.charAt(i);
			if(c == '"' || c == '\\')
			{
				writer.write('\\');
				writer.write(c);
			}
			else if(c == '\r')
			{
				writer.write('\\');
				writer.write('r');
			}
			else if(c == '\n')
			{
				writer.write('\\');
				writer.write('n');
			}
			else if(c == '\t')
			{
				writer.write('\\');
				writer.write('t');
			}
			else if(c == '\b')
			{
				writer.write('\\');
				writer.write('b');
			}
			else if(c == '\f')
			{
				writer.write('\\');
				writer.write('f');
			}
			else if(c <= 0x1F)
			{
				writer.write('\\');
				writer.write('u');

				int v = c;
				int pos = 4;
				do
				{
					encoded[--pos] = DIGITS[v & HEX_MASK];
					v >>>= 4;
				}
				while (v != 0);

				for(int j=0; j<pos; j++) writer.write('0');
				writer.write(encoded, pos, 4 - pos);
			}
			else
			{
				writer.write(c);
			}
		}
	}

	/**
	 * Increase the level by one.
	 *
	 * @param list
	 */
	private void increaseLevel(boolean list)
	{
		level++;

		if(hasData.length == level)
		{
			// Grow lists when needed
			hasData = Arrays.copyOf(hasData, hasData.length * 2);
			lists = Arrays.copyOf(lists, hasData.length * 2);
		}

		hasData[level] = false;
		lists[level] = list;
	}

	/**
	 * Decrease the level by one.
	 *
	 * @throws IOException
	 */
	private void decreaseLevel()
		throws IOException
	{
		level--;

		if(beautify && hasData[level])
		{
			writer.write('\n');

			for(int i=0; i<level; i++)
			{
				writer.write("\t");
			}
		}
	}

	/**
	 * Start a write, will output commas and beautification if needed.
	 *
	 * @throws IOException
	 */
	private void startWrite()
		throws IOException
	{
		if(hasData[level]) writer.write(',');

		hasData[level] = true;

		if(beautify && level > 0)
		{
			writer.write('\n');

			for(int i=0; i<level; i++)
			{
				writer.write('\t');
			}
		}
	}

	/**
	 * Check if the name should be written or not.
	 *
	 * @return
	 */
	private boolean shouldOutputName()
	{
		return level != 0 && ! lists[level];
	}

	@Override
	public void writeObjectStart(String name)
		throws IOException
	{
		startWrite();

		if(shouldOutputName())
		{
			writer.write('"');
			writeEscaped(name);
//			writer.write("\": {");
			writer.write('"');
			writer.write(':');
		}

		writer.write('{');

		increaseLevel(false);
	}

	@Override
	public void writeObjectEnd(String name)
		throws IOException
	{
		decreaseLevel();

		writer.write('}');
	}

	@Override
	public void writeListStart(String name)
		throws IOException
	{
		startWrite();

		if(shouldOutputName())
		{
			writer.write('"');
			writeEscaped(name);
//			writer.write("\": [");
			writer.write('"');
			writer.write(':');
		}

		writer.write('[');

		increaseLevel(true);
	}

	@Override
	public void writeListEnd(String name)
		throws IOException
	{
		decreaseLevel();
		writer.write(']');
	}

	@Override
	public void write(String name, String value)
		throws IOException
	{
		startWrite();

		if(shouldOutputName())
		{
			writer.write('"');
			writeEscaped(name);
//			writer.write("\": ");
			writer.write('"');
			writer.write(':');
		}

		if(value == null)
		{
			writer.write("null");
		}
		else
		{
			writer.write('"');
			writeEscaped(value);
			writer.write('"');
		}
	}

	private void writeUnescaped(String name, String value)
		throws IOException
	{
		startWrite();

		if(shouldOutputName())
		{
			writer.write('"');
			writeEscaped(name);
//			writer.write("\": ");
			writer.write('"');
			writer.write(':');
		}

		if(value == null)
		{
			writer.write("null");
		}
		else
		{
			writer.write(value);
		}
	}

	@Override
	public void write(String name, int number)
		throws IOException
	{
		writeUnescaped(name, Integer.toString(number));
	}

	@Override
	public void write(String name, long number)
		throws IOException
	{
		writeUnescaped(name, Long.toString(number));
	}

	@Override
	public void write(String name, float number)
		throws IOException
	{
		writeUnescaped(name, Float.toString(number));
	}

	@Override
	public void write(String name, double number)
		throws IOException
	{
		writeUnescaped(name, Double.toString(number));
	}

	@Override
	public void write(String name, boolean bool)
		throws IOException
	{
		writeUnescaped(name, Boolean.toString(bool));
	}

	@Override
	public void write(String name, byte[] data)
		throws IOException
	{
		startWrite();

		if(shouldOutputName())
		{
			writer.write('"');
			writeEscaped(name);
			writer.write('"');
			writer.write(':');
		}

		if(data == null)
		{
			writer.write("null");
			return;
		}

		writer.write('"');

		int i = 0;
		for(int n=data.length - 2; i<n; i+=3)
		{
			write(data, i, 3);
		}

		if(i < data.length)
		{
			write(data, i, data.length - i);
		}

		writer.write('"');
	}

	/**
	 * Write some BASE64 encoded bytes.
	 *
	 * @param data
	 * @param pos
	 * @param chars
	 * @param len
	 * @throws IOException
	 */
	private void write(byte[] data, int pos, int len)
		throws IOException
	{
		char[] chars = BASE64;

		int loc = (len > 0 ? (data[pos] << 24) >>> 8 : 0) |
			(len > 1 ? (data[pos+1] << 24) >>> 16 : 0) |
			(len > 2 ? (data[pos+2] << 24) >>> 24 : 0);

		switch(len)
		{
			case 3:
				writer.write(chars[loc >>> 18]);
				writer.write(chars[(loc >>> 12) & 0x3f]);
				writer.write(chars[(loc >>> 6) & 0x3f]);
				writer.write(chars[loc & 0x3f]);
				break;
			case 2:
				writer.write(chars[loc >>> 18]);
				writer.write(chars[(loc >>> 12) & 0x3f]);
				writer.write(chars[(loc >>> 6) & 0x3f]);
				writer.write('=');
				break;
			case 1:
				writer.write(chars[loc >>> 18]);
				writer.write(chars[(loc >>> 12) & 0x3f]);
				writer.write('=');
				writer.write('=');
		}
	}

	@Override
	public void writeNull(String name)
		throws IOException
	{
		write(name, (String) null);
	}

	@Override
	public void flush() throws IOException
	{
		writer.flush();
	}
}
715154
@Override
    public void write(DataWriter writer) throws IOException {
        writer.writeInt(pos);  /* array position */
        writer.writeInt(val);  /* data value */
        writer.writeLong(scn); /* SCN value */
    }
1243990
@Override
  public void write(byte[] b, int off, int len) throws IOException {
    textArea.append(new String(b, off, len));
  }
713917
private void write(char buf[]) {
        try {
            synchronized (this) {
                ensureOpen();
                // Android-changed: Lazily initialized.
                BufferedWriter textOut = getTextOut();
                textOut.write(buf);
                textOut.flushBuffer();
                charOut.flushBuffer();
                if (autoFlush) {
                    for (int i = 0; i < buf.length; i++)
                        if (buf[i] == '\n')
                            out.flush();
                }
            }
        }
        catch (InterruptedIOException x) {
            Thread.currentThread().interrupt();
        }
        catch (IOException x) {
            trouble = true;
        }
    }
289051
synchronized void add(Write write) {
        Exceptions.checkNotClosed(this.closed, this);
        this.writes.addLast(write);
        this.totalLength += write.data.getLength();
        write.setQueueAddedTimestamp(this.timeSupplier.get());
    }
585442
def Write(self, output_writer):
    
    if self._title:
      output_writer.Write('### {0:s}\n\n'.format(self._title))

    if not self._columns:
      self._columns = ['' for _ in range(0, self._number_of_columns)]

    output_writer.Write(' | '.join(self._columns))
    output_writer.Write('\n')

    output_writer.Write(' | '.join(['---' for _ in self._columns]))
    output_writer.Write('\n')

    for values in self._rows:
      values = ['{0!s}'.format(value) for value in values]
      output_writer.Write(' | '.join(values))
      output_writer.Write('\n')

    output_writer.Write('\n')
611395
function write(s) {
		var err
		var args = Array.prototype.slice.call(arguments)
		var cb = typeof args[args.length - 1] === 'function' ? args.pop() : null
		var cbCounter = 1
		if (writeToStdoutEnabled) {
			cbCounter++
			process.stdout.write(s, stdWr)
		}
		if (writeStream) {
			cbCounter++
			writeStream.write(s, wRes)
		}
		end()

		function stdWr(e) {
			if (e) {
				if (!err) err = e
				writeToStdoutEnabled = false
				write('stdout error: ' + e.message)
				self.emit('error', e)
			}
			end()
		}

		function wRes(e) {
			if (e) {
				if (!err) err = e
				writeStream = false
				write('stream error: ' + e.message)
				self.emit('error', e)
			}
			end()
		}

		function end() {
			if (!--cbCounter)
				if (cb)
					if (err) cb(err)
					else cb()
		}
	}
741276
public void write(Writer writer)
        throws IOException
    {
        synchronized(writer)
        {
            for (int i=0;i<_fields.size();i++)
            {
                Field field=(Field)_fields.get(i);
                if (field!=null)
                    field.write(writer,_version);
            }
            writer.write(__CRLF);
        }
    }
1332642
public static void writeTo(String html, Writer writer) throws IOException {
		int index = html.indexOf('#');
		if (index == -1) {
			writer.write(html);
		} else {
			final ResourceBundle resourceBundle = getResourceBundle();
			int begin = 0;
			while (index != -1) {
				writer.write(html, begin, index - begin);
				final int nextIndex = html.indexOf('#', index + 1);
				final String key = html.substring(index + 1, nextIndex);
				writer.write(resourceBundle.getString(key));
				begin = nextIndex + 1;
				index = html.indexOf('#', begin);
			}
			writer.write(html, begin, html.length() - begin);
		}
	}
880805
def writerow(self, row):
        """"""
        json_text = json.dumps(row)
        if isinstance(json_text, bytes):
            json_text = json_text.decode('utf-8')
        self._out.write(json_text)
        self._out.write(u'\n')
985615
@Override
    protected void onWrite(@NotNull WireOut outWire) {
        SubHandler handler = handler();
        if (handler != null)
            handler.onWrite(outWire);

        WriteMarshallable w;
        for (int i = 0; i < writers.size(); i++) {
            try {
                w = writers.get(i);
                if (null == w)
                    continue;

                if (isClosing.get())
                    return;

                w.writeMarshallable(outWire);
            } catch (Exception e) {
                Jvm.fatal().on(getClass(), e);
            }
        }
    }
1091180
void write(Writable value) throws IOException {
    byte[] bval;
    int valSize;
    if (value instanceof BytesWritable) {
      BytesWritable val = (BytesWritable) value;
      bval = val.get();
      valSize = val.getSize();
    } else if (value instanceof Text) {
      Text val = (Text) value;
      bval = val.getBytes();
      valSize = val.getLength();
    } else {
      String sval = value.toString();
      bval = sval.getBytes("UTF-8");
      valSize = bval.length;
    }
    clientOut_.write(bval, 0, valSize);
  }
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());
        }
    }
848088
public void writeAddition(Writer writer, String type, String name) throws IOException {
		writer.append(TAB).append(ANGULAR_MODULE).append(OPENPARENTHESIS).append(MODULENAME).append(CLOSEPARENTHESIS)
				  .append(DOT).append(type).append(OPENPARENTHESIS);
		if(name!=null) {
			writer.append("'").append(name).append("'").append(COMMA).append(SPACEOPTIONAL);
		}
		writer.append(type).append(CLOSEPARENTHESIS).append(SEMICOLON).append(CR); //\tangular.module('ocelot.ds').type(type);
	}
470075
private void write(String str) {
        try {
            m_writer.write(str);
        } catch (IOException ex) {
            throw new RuntimeException(ex);
        }
    }
1031880
public void write(ObjectWriter out, ItemState itemState) throws IOException
   {
      // write id
      out.writeInt(SerializationConstants.ITEM_STATE);

      out.writeInt(itemState.getState());
      out.writeBoolean(itemState.isPersisted());
      out.writeBoolean(itemState.isEventFire());

      if (itemState.getOldPath() == null)
      {
         out.writeInt(SerializationConstants.NULL_DATA);
      }
      else
      {
         out.writeInt(SerializationConstants.NOT_NULL_DATA);
         byte[] buf = itemState.getOldPath().getAsString().getBytes(Constants.DEFAULT_ENCODING);
         out.writeInt(buf.length);
         out.write(buf);
      }

      // write flag isNodeData and ItemData
      ItemData data = itemState.getData();

      boolean isNodeData = (data instanceof PersistedNodeData);
      out.writeBoolean(isNodeData);
      if (isNodeData)
      {
         PersistedNodeDataWriter wr = new PersistedNodeDataWriter();
         wr.write(out, (PersistedNodeData)data);
      }
      else
      {
         PersistedPropertyDataWriter wr = new PersistedPropertyDataWriter();
         wr.write(out, (PersistedPropertyData)data);
      }
   }