Here you can find the source of writeString(OutputStream os, String str)
Parameter | Description |
---|---|
os | The output stream. |
str | The string. |
Parameter | Description |
---|---|
IOException | If an I/O error occurs. |
public static void writeString(OutputStream os, String str) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.io.OutputStream; public class Main { /**//from w w w. j av a 2 s . c o m * Writes a string to the specified output stream. * @param os The output stream. * @param str The string. * @throws IOException If an I/O error occurs. */ public static void writeString(OutputStream os, String str) throws IOException { for (char c : str.toCharArray()) { os.write(c); } os.write('\0'); } }