Java OutputStream Write writeStream(OutputStream output, String dataStr)

Here you can find the source of writeStream(OutputStream output, String dataStr)

Description

Writes a String to the specified OutputStream

License

Apache License

Parameter

Parameter Description
output The OutputStream
dataStr The String to write to the OutputStream

Declaration

public static void writeStream(OutputStream output, String dataStr) throws IOException 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.IOException;

import java.io.OutputStream;

public class Main {
    /**/* w w  w .  j av a2s. c  o  m*/
     *** Writes a String to the specified OutputStream
     *** 
     * @param output
     *            The OutputStream
     *** @param dataStr
     *            The String to write to the OutputStream
     **/
    public static void writeStream(OutputStream output, String dataStr) throws IOException {
        byte data[] = dataStr.getBytes();
        output.write(data, 0, data.length);
    }
}

Related

  1. writeStream(final OutputStream out, final String content, final boolean close)
  2. writeStream(InputStream _from, Writer _printTo)
  3. writeStream(InputStream in, File file)
  4. writeStream(InputStream inputStream, OutputStream out)
  5. writeStream(OutputStream out, byte[] data)
  6. writeStream(OutputStream outputStream, InputStream inputStream, byte[] buffer)
  7. writeStream(String content, String charset, OutputStream outputStream)
  8. writeStreamBuffered(final Reader in, final Writer out)
  9. writeStreamCharwise(final Reader in, final Writer out)