Serialize the given object.

@param outStream The stream to write the serialized data.

@throws IOException
761076
private void writeObject(ObjectOutputStream outStream) throws IOException {
        if (classLoaderToPropagate == SYSTEM_CLASS_LOADER)
            classLoaderIdentifier = "";
        else if (classLoaderToPropagate != null) {
            classLoaderIdentifier = classLoaderContextProvider.getClassLoaderIdentifier(classLoaderToPropagate);
            if (classLoaderIdentifier == null)
                throw new NotSerializableException(classLoaderToPropagate.getClass().getName());
        }
        PutField fields = outStream.putFields();
        fields.put(CLASS_LOADER_IDENTIFIER, classLoaderIdentifier);
        outStream.writeFields();
    }
1038782
private void writeObject(ObjectOutputStream out) throws IOException {
        ClassRef.write(out, type);
        out.writeUTF(name);
        out.writeObject(val);
    }
325464
private void writeObject(ObjectOutputStream out) throws IOException {
        ClassRef.write(out, result);
        ClassRef.write(out, arg);
        out.writeUTF(name);
    }
171778
public void encode(InputStream inStream, OutputStream outStream)
        throws IOException {
        int     j;
        int     numBytes;
        byte    tmpbuffer[] = new byte[bytesPerLine()];

        encodeBufferPrefix(outStream);

        while (true) {
            numBytes = readFully(inStream, tmpbuffer);
            if (numBytes == 0) {
                break;
            }
            encodeLinePrefix(outStream, numBytes);
            for (j = 0; j < numBytes; j += bytesPerAtom()) {

                if ((j + bytesPerAtom()) <= numBytes) {
                    encodeAtom(outStream, tmpbuffer, j, bytesPerAtom());
                } else {
                    encodeAtom(outStream, tmpbuffer, j, (numBytes)- j);
                }
            }
            if (numBytes < bytesPerLine()) {
                break;
            } else {
                encodeLineSuffix(outStream);
            }
        }
        encodeBufferSuffix(outStream);
    }
1285267
public void serialize(final OutputStream out) throws IOException {
    final Writer writer = new BufferedWriter(new OutputStreamWriter(out));
    this.seqModel.serialize(out);
    writer.flush();
  }
362840
private void writeObject(ObjectOutputStream out) throws IOException {
        PutField fields = out.putFields();
        fields.put(PRINCIPAL, principal);
        fields.put(JWT, jwt);
        fields.put(TYPE, type);
        out.writeFields();
    }
961658
@Override
    public void writeObject(Object obj, AbstractHessianOutput out)
        throws IOException
    {
        if (out.addRef(obj)) {
            return;
        }

        int ref = out.writeObjectBegin(getClassName(obj));

        if (ref < -1) {
            out.writeString("value");

            InputStream is = null;

            try {
                is = getInputStream(obj);
            } catch (Exception e) {
                log.log(Level.WARNING, e.toString(), e);
            }

            if (is != null) {
                try {
                    out.writeByteStream(is);
                } finally {
                    is.close();
                }
            } else {
                out.writeNull();
            }

            out.writeMapEnd();
        }
        else {
            if (ref == -1) {
                out.writeClassFieldLength(1);
                out.writeString("value");

                out.writeObjectBegin(getClassName(obj));
            }

            InputStream is = null;

            try {
                is = getInputStream(obj);
            } catch (Exception e) {
                log.log(Level.WARNING, e.toString(), e);
            }

            try {
                if (is != null)
                    out.writeByteStream(is);
                else
                    out.writeNull();
            } finally {
                if (is != null)
                    is.close();
            }
        }
    }
1269698
def _write_object(self, val, outstream):
        '''
        
        '''
        # first attempt using an existing custom serializer
        serializer = self.__lookup_serializer(getattr(val, '__class__'))
        if serializer is not None:
            serializer.serialize(self, val, outstream)
            return
        
        fields = self._fetch_obj_fields(val)
        validfields = [];
        encodedfields = []
        length = 0;
        for f in fields:
            encoded = self._encode_field_name(val, f)
            if encoded:
                encodedfields.append(encoded)
                validfields.append(f)
                length += 1;
        self.write_object_start(length, outstream)
        count = 0;
        if length > 0:
            mappedname = encodedfields[0]
            if mappedname is not None:
                count += 1
                self.write_object_field(mappedname, getattr(val, validfields[0]), outstream)
            idx = 1
            while idx < length:      
                name = validfields[idx]
                mappedname = encodedfields[idx]
                if mappedname is not None:
                    value = getattr(val, name)
                    if count > 0:
                        self.write_object_field_separator(mappedname, value, outstream)
                    self.write_object_field(mappedname, value, outstream)
                    count += 1
                idx += 1
        self.write_object_end(length, outstream)
247341
public void writeObject(@NonNull ObjectOutputStream stream) throws IOException {
        stream.writeObject(id);
        stream.writeLong(createdTime);
        stream.writeLong(lastAccessedTime);
        stream.writeInt(maxInactiveInterval);
        stream.writeBoolean(isNew);
        stream.writeBoolean(isValid);
        stream.writeInt(mAttributes.size());
        String keys[] = mAttributes.keySet().toArray(EMPTY_ARRAY);
        for (String key : keys) {
            Object value = mAttributes.get(key);
            if (value != null && value instanceof Serializable) {
                stream.writeObject(key);
                stream.writeObject(value);
            }
        }
    }
444218
public void writeTo(final OutputStream outputStream) throws IOException {
        outputStream.write(getSigningKey());
        outputStream.write(getEncryptionKey());
    }
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);
			}
		}
	}
741136
private void writeObject(ObjectOutputStream stream) throws IOException {

        /*
         * Since this is a simple class all we have to do is write each member to the stream.
         * the order has to remain identical to readObject, so I've just gone alphabetically.
         *
         * If we change the serialversionUID, we may need to modify this method as well.
         */

        if (tc.isEntryEnabled()) {
            Tr.entry(this, tc, "writeObject", stream);
        }

        ObjectOutputStream.PutField putField = stream.putFields();

        putField.put("activationConfigProps", activationConfigProps);
        putField.put("destinationRef", destinationRef);
        putField.put("authenticationAlias", authenticationAlias);
        putField.put("applicationName", applicationName);
        putField.put("qmid", qmid);

        stream.writeFields();

        if (tc.isEntryEnabled()) {
            Tr.exit(this, tc, "writeObject activation config - " + this.toString());
        }

    }
859593
public static int serialize(OutputStream stream, Object obj) {
        ObjectMapper mapper = createMapperWithJaxbAnnotationInspector();

        try (DataOutputStream data = new DataOutputStream(stream);
             OutputStreamWriter writer = new OutputStreamWriter(data, StandardCharsets.UTF_8)) {
            mapper.writerWithDefaultPrettyPrinter().writeValue(writer, obj);
            return data.size();
        } catch (IOException e) {
            throw new ReportGenerationException(e);
        }
    }
299280
protected void bitcoinSerializeToStream(OutputStream stream, boolean useSegwit) throws IOException {
        // version
        uint32ToByteStreamLE(version, stream);
        // marker, flag
        if (useSegwit) {
            stream.write(0);
            stream.write(1);
        }
        // txin_count, txins
        stream.write(new VarInt(inputs.size()).encode());
        for (TransactionInput in : inputs)
            in.bitcoinSerialize(stream);
        // txout_count, txouts
        stream.write(new VarInt(outputs.size()).encode());
        for (TransactionOutput out : outputs)
            out.bitcoinSerialize(stream);
        // script_witnisses
        if (useSegwit) {
            for (TransactionInput in : inputs) {
                in.getWitness().bitcoinSerializeToStream(stream);
            }
        }
        // lock_time
        uint32ToByteStreamLE(lockTime, stream);
    }
1312385
public void save(OutputStream stream, boolean header, boolean flush) throws IOException {
        OutputStreamWriter out = new OutputStreamWriter(stream, "UTF-8");
        save(out, header, flush);
    }
530329
public void writeObject (ObjectOutputStream out)
        throws IOException
    {
        out.writeInt(_size);
        for (int ii = 0; ii < _size; ii++) {
            out.writeInt(_values[ii]);
        }
    }
162209
public static void writeObjectToStream(final Object o, OutputStream out) {
    out = new BufferedOutputStream(out);
    try {
      final ObjectOutputStream oos = new ObjectOutputStream(out);
      oos.writeObject(o);
      oos.flush();
    } catch (final IOException e) {
      e.printStackTrace();
    }
  }