Java Utililty Methods OutputStream Write String

List of utility methods to do OutputStream Write String

Description

The list of methods to do OutputStream Write String are organized into topic(s).

Method

voidwriteStringStringMap(Map map, OutputStream os)
write String String Map
if (map != null) {
    writeInt(os, map.size());
    for (Map.Entry<String, String> entry : map.entrySet()) {
        writeString(os, entry.getKey());
        writeString(os, entry.getValue());
} else {
    writeInt(os, 0);
...
voidWriteStringToOutputStream(String data, OutputStream os)
Write String To Output Stream
for (Character c : data.toCharArray()) {
    os.write((int) c.charValue());
voidwriteStringToStream(final OutputStream stream, final String string)
write String To Stream
Writer writer = new OutputStreamWriter(stream, DEFAULT_ENCODING);
writer.write(string);
writer.close();
voidwriteStringToStream(final String s, final OutputStream outputStream)
Writes the given string to the stream.
final StringReader reader = new StringReader(s);
int b;
while ((b = reader.read()) >= 0) {
    outputStream.write(b);
outputStream.flush();
voidwriteStringToStream(OutputStream out, String contents, String charset)
write String To Stream
try {
    byte[] bytes = contents.getBytes(charset);
    out.write(bytes);
    out.close();
} catch (Exception e) {
} finally {
    try {
        out.close();
...
voidwriteStringToUtf8(final String str, final OutputStream out)
write String To Utf
final int length = str.length();
int i = 0;
char c;
while (i < length) {
    c = str.charAt(i++);
    if (c < 0x80) {
        out.write(c);
        continue;
...