Serializes the current Fst instance to an ObjectOutput

@param out the ObjectOutput. It should be already be initialized by the caller.
178041
public static void writeFstToBinaryStream(Fst fst, ObjectOutput out) throws IOException {
    out.writeInt(CURRENT_VERSION);
    writeStringMap(fst.getInputSymbols(), out);
    writeStringMap(fst.getOutputSymbols(), out);
    out.writeBoolean(fst.isUsingStateSymbols()); // whether or not we used a state symbol table
    if (fst.isUsingStateSymbols()) {
      writeStringMap(fst.getStateSymbols(), out);
    }
    out.writeInt(fst.getStartState().getId());

    out.writeObject(fst.getSemiring());
    out.writeInt(fst.getStateCount());

    Map<State, Integer> stateMap = new IdentityHashMap<>(fst.getStateCount());
    for (int i = 0; i < fst.getStateCount(); i++) {
      State s = fst.getState(i);
      out.writeInt(s.getArcCount());
      out.writeDouble(s.getFinalWeight());
      out.writeInt(s.getId());
      stateMap.put(s, i);
    }

    int numStates = fst.getStateCount();
    for (int i = 0; i < numStates; i++) {
      State s = fst.getState(i);
      int numArcs = s.getArcCount();
      for (int j = 0; j < numArcs; j++) {
        Arc a = s.getArc(j);
        out.writeInt(a.getIlabel());
        out.writeInt(a.getOlabel());
        out.writeDouble(a.getWeight());
        out.writeInt(stateMap.get(a.getNextState()));
      }
    }
  }
128450
public void writeObject (ObjectOutputStream out)
        throws IOException
    {
        int ecount = size();
        out.writeInt(ecount);
        for (IntIntEntry entry : entrySet()) {
            out.writeInt(entry.getIntKey());
            out.writeInt(entry.getIntValue());
        }
    }
411976
@Override
    public void writeExternal(ObjectOutput output) throws IOException {
        output.writeInt(SERIALIZATION_V2);
        output.writeInt(this.storage.size());
        output.writeInt(this.numberOfHeaders);
        int count = 0;
        HeaderElement elem = this.hdrSequence;
        while (null != elem) {
            if (!elem.wasRemoved()) {
                count++;
                writeByteArray(output, elem.getKey().getByteArray());
                writeByteArray(output, elem.asBytes());
            }
            elem = elem.nextSequence;
        }
        // double check the counter value
        if (count != this.numberOfHeaders) {
            throw new IOException("Expected " + this.numberOfHeaders
                                  + " headers but wrote " + count);
        }
    }
445146
@Trivial
    private void writeObject(ObjectOutputStream out) throws IOException {
        PutField fields = out.putFields();
        fields.put(FAILURE, failure);
        fields.put(PREVIOUS_RESULT, previousResult);
        out.writeFields();
    }
533055
private void writeObject(ObjectOutputStream out) throws IOException {
		out.defaultWriteObject();

		final int size = dataSet.size();
		out.writeInt(size);

		if (size > 0) {
			DataOutputViewStreamWrapper wrapper = new DataOutputViewStreamWrapper(out);
			for (T element : dataSet){
				serializer.serialize(element, wrapper);
			}
		}
	}
49179
public void writeObject (Output output, Object object, Serializer serializer) {
		if (output == null) throw new IllegalArgumentException("output cannot be null.");
		if (object == null) throw new IllegalArgumentException("object cannot be null.");
		if (serializer == null) throw new IllegalArgumentException("serializer cannot be null.");
		beginObject();
		try {
			if (references && writeReferenceOrNull(output, object, false)) return;
			if (TRACE || (DEBUG && depth == 1)) log("Write", object, output.position());
			serializer.write(this, output, object);
		} finally {
			if (--depth == 0 && autoReset) reset();
		}
	}
1265206
private void writeObject(ObjectOutputStream out) throws IOException {
		out.writeUTF(hadoopInputFormatName);
		jobConf.write(out);
		out.writeObject(converter);
	}
850624
private void writeObject(final ObjectOutputStream out) throws IOException {
		out.writeObject(mapper.getClass());
		jobConf.write(out);
	}
1094379
public void writeObject (Output output, Object object) {
		if (output == null) throw new IllegalArgumentException("output cannot be null.");
		if (object == null) throw new IllegalArgumentException("object cannot be null.");
		beginObject();
		try {
			if (references && writeReferenceOrNull(output, object, false)) return;
			if (TRACE || (DEBUG && depth == 1)) log("Write", object, output.position());
			getRegistration(object.getClass()).getSerializer().write(this, output, object);
		} finally {
			if (--depth == 0 && autoReset) reset();
		}
	}
796078
private void writeObject(final ObjectOutputStream out)
		throws IOException
	{
		out.defaultWriteObject();
		out.writeLong(getGeneration());
		out.writeObject(getGenotype());
		out.writeObject(getFitness());
		out.writeObject(getRawFitness());
	}
1161663
@Override
    public void writeExternal(ObjectOutput s) throws IOException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "writeExternal(ObjectOutput)");
        }
        convertBufferIfNeeded();
        super.writeExternal(s);
    }
1228077
void writeObject(java.io.ObjectOutputStream out) throws IOException {
        // when using object serialization, write the json bytes
        byte[] bytes = toString().getBytes(StandardCharsets.UTF_8);
        out.writeInt(bytes.length);
        out.write(bytes);
    }
284552
@Override
  public void writeExternal(ObjectOutput out) throws IOException {
    super.writeExternal(out);
    out.writeBoolean(isLeaf);
    out.writeInt(numEntries);
    // Entries will be written in subclasses
  }
204672
public void writeObject (ObjectOutputStream out)
        throws IOException
    {
        out.writeInt(_size);
        for (int ii = 0; ii < _size; ii++) {
            out.writeObject(_entries[ii]);
        }
    }
624212
private void writeObject(final ObjectOutputStream out) throws IOException {

		out.writeObject(reducer.getClass());
		out.writeObject(combiner.getClass());
		jobConf.write(out);
	}
435592
private void writeObject(ObjectOutputStream out) throws IOException {
		super.write(out);
		out.writeUTF(this.mapreduceOutputFormat.getClass().getName());
		this.configuration.write(out);
	}
699516
private void writeObject (ObjectOutputStream out)
        throws IOException
    {
        out.defaultWriteObject();
        for (int idx = 0, pos = 0; pos < _size; idx++) {
            int value = _buckets[idx];
            if (value != _sentinel) {
                out.writeInt(value);
                pos++;
            }
        }
    }