Writes the content from object to output.

@param   object  IChemObject of which the data is given as output.
160518
@Override
    public void write(IChemObject object) throws CDKException {
        if (object instanceof IAtomContainerSet) {
            writeAtomContainerSet((IAtomContainerSet) object);
        } else if (object instanceof IAtomContainer) {
            writeAtomContainer((IAtomContainer) object);
        } else {
            throw new CDKException("Only supported is writing of ChemFile and Molecule objects.");
        }
    }
576437
@SuppressWarnings("unchecked")
  public final void writeObject(TextWriterStream out, String label, Object object) throws IOException {
    write(out, label, (O) object);
  }
766634
protected function writeObjectInheritance($object, $parentName)
    {
        try {
            $parent      = $this->reflector->getClass($parentName);
            $longName    = $parent->getName();

            $this->writeObjectElement($parent);

        } catch (\Exception $e) {
            // object is undeclared in data source
            $parts       = explode('\\', $parentName);
            $shortName   = array_pop($parts);
            $longName    = $parentName;
            $ns          = implode($this->namespaceSeparator, $parts);

            if (!isset($this->objects[$ns])) {
                $this->objects[$ns] = array();
            }

            if (!array_key_exists($shortName, $this->objects[$ns])) {
                $type = $object->isInterface() ? 'interface' : 'class';
                $this->pushObject($ns, $shortName, $longName, $type);
            }
        }

        $this->pushEdge(array($object->getName(), $longName));
    }
19917
private void writeObject(java.io.ObjectOutputStream out) throws IOException
	{
		if (delegateMethods != null)
		{
			delegateMethods.clear();
		}

		out.defaultWriteObject();
	}
504753
private Serializer write(Object object) throws IOException {
        if (null == object) return writeNull();
        if (object instanceof Number) return writeNumber((Number) object);
        if (object instanceof String) return writeString((String) object);
        if (object instanceof Boolean) return writeBoolean((Boolean) object);
        if (object instanceof JSONObject) return writeObject((JSONObject) object);
        if (object instanceof JSONArray) return writeArray((JSONArray) object);

        throw new IOException("Attempting to serialize unserializable object: '" + object + "'");
    }
1119495
public void writeObject(Object object)
        throws IOException
    {
        if (object == null) {
            writeNull();
            return;
        }

        Serializer serializer;

        serializer = _serializerFactory.getSerializer(object.getClass());

        serializer.writeObject(object, this);
    }
102291
private void writeObject(ObjectOutputStream out) throws IOException {
		super.write(out);
		out.writeUTF(mapredOutputFormat.getClass().getName());
		jobConf.write(out);
	}
1066605
protected JsonWriter writeObject(Object object) throws IOException {
      if (object == null) {
         nullValue();
      } else if (object instanceof JsonSerializable) {
         JsonSerializable structuredSerializable = Cast.as(object);
         if (object instanceof JsonArraySerializable) {
            beginArray();
         } else {
            beginObject();
         }
         structuredSerializable.toJson(this);
         if (object instanceof JsonArraySerializable) {
            endArray();
         } else {
            endObject();
         }
      } else if (object instanceof Number) {
         value(Cast.<Number>as(object));
      } else if (object instanceof String) {
         value(Cast.<String>as(object));
      } else if (object instanceof Boolean) {
         value(Cast.<Boolean>as(object).toString());
      } else if (object instanceof Enum) {
         value(Cast.<Enum>as(object).name());
      } else if (object instanceof EnumValue) {
         value(Cast.<EnumValue>as(object).name());
      } else if (object instanceof Map) {
         value(Cast.<Map<String, ?>>as(object));
      } else if (object.getClass().isArray()) {
         value(Cast.<Object[]>as(object));
      } else if (object instanceof Multimap) {
         value(Cast.<Multimap<String, ?>>as(object).asMap());
      } else if (object instanceof Counter) {
         value(Cast.<Counter<String>>as(object).asMap());
      } else if (object instanceof Iterable) {
         value(Cast.<Iterable>as(object));
      } else if (object instanceof Iterator) {
         value(Cast.<Iterator>as(object));
      } else {
         value(Convert.convert(object, String.class));
      }
      return this;
   }
1142741
public static void writeObject(File file, Object object) throws IOException {
        FileOutputStream fileOut = new FileOutputStream(file);
        ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(fileOut));
        try {
            out.writeObject(object);
            out.flush();
            // Force sync
            fileOut.getFD().sync();
        } finally {
            IoUtils.safeClose(out);
        }
    }
530329
public void writeObject (ObjectOutputStream out)
        throws IOException
    {
        out.writeInt(_size);
        for (int ii = 0; ii < _size; ii++) {
            out.writeInt(_values[ii]);
        }
    }
445146
@Trivial
    private void writeObject(ObjectOutputStream out) throws IOException {
        PutField fields = out.putFields();
        fields.put(FAILURE, failure);
        fields.put(PREVIOUS_RESULT, previousResult);
        out.writeFields();
    }
1030034
public void writeObject (ObjectOutputStream out)
        throws IOException
    {
        out.writeInt(size());
        for (E value : this) {
            out.writeObject(value);
        }
    }
850579
public final void writeObject(java.io.DataOutputStream dataOutputStream)
                    throws ObjectManagerException
    {
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this, cclass,
                        "writeObject",
                        "dataOutputStream=" + dataOutputStream);

        try {
            dataOutputStream.writeByte(SimpleSerialVersion);
            super.writeObject(dataOutputStream);

            dataOutputStream.writeInt(activeSubListCount);
            for (int i = 0; i < subListTokens.length; i++) {
                subListTokens[i].writeObject(dataOutputStream);
            } // for subLists.

        } catch (java.io.IOException exception) {
            // No FFDC Code Needed.
            ObjectManager.ffdc.processException(this,
                                                cclass,
                                                "writeObject",
                                                exception,
                                                "1:1229:1.26");

            if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
                trace.exit(this, cclass
                           , "writeObject"
                           , "via PermanentIOException"
                                );
            throw new PermanentIOException(this,
                                           exception);
        } // catch (java.io.IOException exception).

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this, cclass,
                       "writeObject");
    }
796078
private void writeObject(final ObjectOutputStream out)
		throws IOException
	{
		out.defaultWriteObject();
		out.writeLong(getGeneration());
		out.writeObject(getGenotype());
		out.writeObject(getFitness());
		out.writeObject(getRawFitness());
	}
120723
@Override
  public void write(TextWriterStream out, String label, TextWriteable obj) {
    obj.writeToText(out, label);
  }
961303
public void writeObject(Object object)
        throws IOException
    {
        if (object == null)
            writeNull();
        else if (object instanceof String)
            writeString((String) object);
        else if (object instanceof Boolean)
            writeBoolean(((Boolean) object).booleanValue());
        else if (object instanceof Integer)
            writeInt(((Integer) object).intValue());
        else if (object instanceof Long)
            writeLong(((Long) object).longValue());
        else if (object instanceof Date)
            writeUTCDate(((Date) object).getTime());
        else if (object instanceof byte[]) {
            byte[] data = (byte[]) object;
            writeBytes(data, 0, data.length);
        }
        else if (object instanceof Vector) {
            Vector vector = (Vector) object;

            int size = vector.size();
            writeListBegin(size, null);
            for (int i = 0; i < size; i++)
                writeObject(vector.elementAt(i));

            writeListEnd();
        }
        else if (object instanceof Hashtable) {
            Hashtable hashtable = (Hashtable) object;

            writeMapBegin(null);
            Enumeration e = hashtable.keys();
            while (e.hasMoreElements()) {
                Object key = e.nextElement();
                Object value = hashtable.get(key);

                writeObject(key);
                writeObject(value);
            }
            writeMapEnd();
        }
        else
            writeCustomObject(object);
    }

    /**
     * Applications which override this can do custom serialization.
     *
     * @param object the object to write.
     */
    public void writeCustomObject(Object object)
        throws IOException
    {
        throw new IOException("unexpected object: " + object);
    }

    /**
     * Writes the list header to the stream.  List writers will call
     * <code>writeListBegin</code> followed by the list contents and then
     * call <code>writeListEnd</code>.
     *
     * <code><pre>
     * &lt;list>
     *   &lt;type>java.util.ArrayList&lt;/type>
     *   &lt;length>3&lt;/length>
     *   &lt;int>1&lt;/int>
     *   &lt;int>2&lt;/int>
     *   &lt;int>3&lt;/int>
     * &lt;/list>
     * </pre></code>
     */
    public void writeListBegin(int length, String type)
        throws IOException
    {
        os.write('V');
        os.write('t');
        printLenString(type);

        os.write('l');
        os.write(length >> 24);
        os.write(length >> 16);
        os.write(length >> 8);
        os.write(length);
    }

    /**
     * Writes the tail of the list to the stream.
     */
    public void writeListEnd()
        throws IOException
    {
        os.write('z');
    }

    /**
     * Writes the map header to the stream.  Map writers will call
     * <code>writeMapBegin</code> followed by the map contents and then
     * call <code>writeMapEnd</code>.
     *
     * <code><pre>
     * Mt b16 b8 type (<key> <value>)z
     * </pre></code>
     */
    public void writeMapBegin(String type)
        throws IOException
    {
        os.write('M');
        os.write('t');
        printLenString(type);
    }

    /**
     * Writes the tail of the map to the stream.
     */
    public void writeMapEnd()
        throws IOException
    {
        os.write('z');
    }

    /**
     * Writes a remote object reference to the stream.  The type is the
     * type of the remote interface.
     *
     * <code><pre>
     * 'r' 't' b16 b8 type url
     * </pre></code>
     */
    public void writeRemote(String type, String url)
        throws IOException
    {
        os.write('r');
        os.write('t');
        printLenString(type);
        os.write('S');
        printLenString(url);
    }

    /**
     * Prints a string to the stream, encoded as UTF-8 with preceeding length
     *
     * @param v the string to print.
     */
    public void printLenString(String v)
        throws IOException
    {
        if (v == null) {
            os.write(0);
            os.write(0);
        }
        else {
            int len = v.length();
            os.write(len >> 8);
            os.write(len);

            printString(v, 0, len);
        }
    }

    /**
     * Prints a string to the stream, encoded as UTF-8
     *
     * @param v the string to print.
     */
    public void printString(String v)
        throws IOException
    {
        printString(v, 0, v.length());
    }

    /**
     * Prints a string to the stream, encoded as UTF-8
     *
     * @param v the string to print.
     */
    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));
            }
        }
    }
}
1034701
@Override
    public void writeRemoteObject(OutputStream out, @Sensitive Object obj) throws org.omg.CORBA.SystemException {
        WSUtilService service = WSUtilService.getInstance();
        if (service != null) {
            obj = service.replaceObject(obj);
        }
        super.writeRemoteObject(out, obj);
    }