Java OutputStream Write writeStream(final OutputStream out, final String content, final boolean close)

Here you can find the source of writeStream(final OutputStream out, final String content, final boolean close)

Description

Write a string

License

Open Source License

Parameter

Parameter Description
out where to write to
content what to write
close whether to close the stream

Declaration

protected static void writeStream(final OutputStream out, final String content, final boolean close) 

Method Source Code

//package com.java2s;

import java.io.OutputStream;

import java.io.PrintWriter;

public class Main {
    /**/*from  w w  w .j a v  a 2s .  c o m*/
     * Write a string
     * 
     * @param out where to write to
     * @param content what to write
     * @param close whether to close the stream
     */
    protected static void writeStream(final OutputStream out, final String content, final boolean close) {
        final PrintWriter writer = new PrintWriter(out);
        writer.println(content);
        if (close) {
            writer.close();
        }
    }
}

Related

  1. serializeTo(OutputStream outputStream, Object obj)
  2. serializeToOutputStream(final Serializable ser, final OutputStream os)
  3. serializeUUID(OutputStream out, UUID id)
  4. writeStream(byte[] data, OutputStream os)
  5. writeStream(byte[] data, OutputStream out)
  6. writeStream(InputStream _from, Writer _printTo)
  7. writeStream(InputStream in, File file)
  8. writeStream(InputStream inputStream, OutputStream out)
  9. writeStream(OutputStream out, byte[] data)