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

voidwriteString(OutputStream out, String s)
Write a String.
writeBytes(out, s.getBytes("UTF-8"));
voidwriteString(OutputStream out, String s)
write String
byte[] b = s.getBytes();
out.write(b, 0, b.length);
voidwriteString(OutputStream out, String s)
write String
for (int i = 0; i < s.length(); i++)
    writeChar(out, s.charAt(i));
voidwriteString(OutputStream out, String s)
write String
if (s == null) {
    writeInt(out, 0);
} else {
    byte[] bytes = s.getBytes("UTF-8");
    writeInt(out, bytes.length);
    out.write(bytes);
voidwriteString(OutputStream out, String s)
write String
for (int i = 0; i < s.length(); i++)
    writeChar(out, s.charAt(i));
voidwriteString(OutputStream out, String str)
Write a string (not null-terminated).
out.write(str.getBytes());
voidwriteString(OutputStream out, String str)
write String
try {
    byte[] array = str.getBytes("UTF-8");
    ByteArrayInputStream in = new ByteArrayInputStream(array);
    copy(in, out);
} finally {
    out.close();
voidWriteString(OutputStream output, String string)
Write String
for (int loop = 0; loop < string.length(); ++loop)
    output.write((byte) (string.charAt(loop)));
voidwriteString(OutputStream output, String string)
write String
output.write(("<" + Integer.toString(string.length()) + ">").getBytes());
output.write(("<" + string + ">").getBytes());
voidwriteString(String data, int length, OutputStream out)
write String
byte[] s = getBytes(data);
byte[] b = new byte[length];
System.arraycopy(s, 0, b, 0, s.length);
out.write(b, 0, length);