Writes the bean to the {@code OutputStream}.
<p>
The type of the bean will be set in the message.

@param bean  the bean to output, not null
@param output  the output stream, not null
@throws IOException if an error occurs
352231
public void write(Bean bean, OutputStream output) throws IOException {
        write(bean, true, output);
    }
694355
void write(ObjectOutputStream out) throws IOException {
        PutField fields = out.putFields();

        fields.put(CONTEXT, threadContextDescriptor.serialize());

        fields.put(EXEC_PROPS, threadContextDescriptor.getExecutionProperties());

        fields.put(INTERNAL_PROP_NAMES, internalPropNames);

        ByteArrayOutputStream bout = new ByteArrayOutputStream();
        ObjectOutputStream oout = new ObjectOutputStream(bout);
        oout.writeObject(object);
        oout.flush();
        fields.put(OBJECT, bout.toByteArray());
        oout.close();

        out.writeFields();
    }
145882
private void writeObject(ObjectOutputStream out) throws IOException {
        if (!_peer.equals(this) && !(_peer instanceof Serializable)) {
            throw new IOException("Bean context child delegate does not support serialization!!!");
        }
        out.defaultWriteObject();
    }
20637
public void write(PrintStream stream) {
        this.output = stream;
        dispatch(base, false);
        stream.flush();
    }
118535
public static void writeToOutputStream(String s, OutputStream output, String encoding) throws IOException {
		BufferedReader reader = new BufferedReader(new StringReader(s));
		PrintStream writer;
		if (encoding != null) {
			writer = new PrintStream(output, true, encoding);
		}
		else {
			writer = new PrintStream(output, true);
		}
		String line;
		while ((line = reader.readLine()) != null) {
			writer.println(line);
		}
	}
75288
@Override
    public void writeExternal(ObjectOutput output) throws IOException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
            Tr.event(tc, "Serializing: " + this);
        }
        super.writeExternal(output);
        output.writeShort(getStatusCodeAsInt());
        writeByteArray(output, this.myReasonBytes);
    }
863702
public void writeTo(OutputStream out) throws IOException {
        if (!(out instanceof DataOutput)) {
            out = new DataOutputStream(out);
        }

        writeTo((DataOutput)out);

        out.flush();
    }
170687
public static <T> void writeTo(OutputStream out, T message, Schema<T> schema,
            XMLOutputFactory outFactory) throws IOException
    {
        XMLStreamWriter writer = null;
        try
        {
            writer = outFactory.createXMLStreamWriter(out, XML_ENCODING);

            writer.writeStartDocument(XML_ENCODING, XML_VERSION);
            writeTo(writer, message, schema);
            writer.writeEndDocument();

            writer.flush();
        }
        catch (XMLStreamException e)
        {
            throw new XmlOutputException(e);
        }
        finally
        {
            if (writer != null)
            {
                try
                {
                    writer.close();
                }
                catch (XMLStreamException e)
                {
                    // ignore
                }
            }
        }
    }
874884
public static void writeTag(OutputStream out, Tag tag) throws IOException {
        writeTag(out, tag, false);
    }
518982
private void writeObject(java.io.ObjectOutputStream out) throws IOException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "writeObject", out);

        try {
            if (requiresInit)
                lazyInitForReading();

            // If message is in write mode, get data into byte array so that we
            // can restore the output stream during readObject.
            // If message is in read mode, store the offset so that we can skip
            // the input stream during readObject.
            if (isBodyReadOnly()) {
                // read mode
                streamOffset = dataBuffer.length - readStream.available();
            }
            else {
                // write mode
                if (_writeBytes != null) {
                    // SIB0121: If the producer has promised not to modify the payload after set,
                    // _writeBytes will always be null
                    dataBuffer = _writeBytes.toByteArray();
                }
            }
            // Use the default mechanism to write the fields.
            out.defaultWriteObject();
        } catch (IOException e) {
            // No FFDC code needed
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                SibTr.debug(this, tc, "Error during writeObject", e);
            // pass on
            throw e;
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "writeObject");
    }
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();
            }
        }
    }
1154664
public static <T> void writeTo(OutputStream out, T message, Schema<T> schema)
            throws IOException
    {
        writeTo(out, message, schema, DEFAULT_OUTPUT_FACTORY);
    }
288656
public void write(final T source) throws IOException {
        
        Objects.requireNonNull(source, "the bean to write should not be null.");
        
        // update the current row/line numbers
        super.incrementRowAndLineNo();
        
        final CsvContext context = new CsvContext(getLineNumber(), getRowNumber(), 1);
        context.setRowSource(Collections.emptyList());  // 空の値を入れる
        
        final CsvBindingErrors bindingErrors = new CsvBindingErrors(beanMappingCache.getOriginal().getType());
        
        // コールバックメソッドの実行（書き込み前）
        for(CallbackMethod callback : beanMappingCache.getOriginal().getPreWriteMethods()) {
            callback.invoke(source, context, bindingErrors, beanMappingCache.getOriginal());
        }
        
        // extract the bean values
        extractBeanValues(source, beanMappingCache.getNameMapping());
        context.setRowSource(new ArrayList<Object>(beanValues));
        
        Optional<SuperCsvRowException> rowException = Optional.empty();
        try {
            executeCellProcessors(processedColumns, beanValues, beanMappingCache.getCellProcessorsForWriting(), context);
            
        } catch(SuperCsvRowException e) {
            /*
             * カラムごとのCellProcessorのエラーの場合、別なValidatorで値を検証するために、
             * 後から判定を行うようにする。
             */
            rowException = Optional.of(e);
            
            final List<CsvError> errors = exceptionConverter.convert(e, beanMappingCache.getOriginal());
            bindingErrors.addAllErrors(errors);
            
        } catch(SuperCsvException e) {
            // convert exception and format to message.
            errorMessages.addAll(exceptionConverter.convertAndFormat(e, beanMappingCache.getOriginal()));
            throw e;
        }
        
        // レコード、Beanの入力値検証
        if(!beanMappingCache.getOriginal().isSkipValidationOnWrite()) {
            for(CsvValidator<T> validator : validators) {
                validator.validate(source, bindingErrors, new ValidationContext<>(context, beanMappingCache.getOriginal()));
            }
        }
        
        // エラーメッセージの変換
        processErrors(bindingErrors, context, rowException);
        
        // write the list
        super.writeRow(processedColumns);
        
        // コールバックメソッドの実行（書き込み後）
        for(CallbackMethod callback : beanMappingCache.getOriginal().getPostWriteMethods()) {
            callback.invoke(source, context, bindingErrors, beanMappingCache.getOriginal());
        }
        
        // エラーメッセージの変換
        processErrors(bindingErrors, context, rowException);
        
    }
867883
public void writeTo(final OutputStream output) throws IOException {
    final CodedOutputStream codedOutput = CodedOutputStream.newInstance(output);
    writeTo(codedOutput);
    codedOutput.flush();
  }
935247
public void write(Object object, OutputStream os, MediaType mediaType)
            throws IOException {
        XStream xstream = getXStreamInstance(mediaType);
        if (xstream != null) {
            xstream.toXML(object, os);
        } else {
            throw new IllegalArgumentException("Content-type: "
                    + mediaType.getType() + " is currently not supported for "
                    + object.getClass().getName());
        }
    }
1240284
public static void writeValue(OutputStream stream, Object pojo) throws IOException {
        DataModelSerializer.serializeAsStream(pojo, stream);
    }
1038782
private void writeObject(ObjectOutputStream out) throws IOException {
        ClassRef.write(out, type);
        out.writeUTF(name);
        out.writeObject(val);
    }