The list of methods to do DataOutputStream Write String are organized into topic(s).
void
writeString(DataOutputStream buf, String value) write String
if (value.contains("0円")) {
throw new IllegalArgumentException("Null characters are not allowed in null-terminated strings.");
buf.writeBytes(value);
buf.writeByte((byte) 0);
void
writeString(DataOutputStream os, String s) write String to DataOutputStream motivation: DataInputStream.readUTF can't print lines larger than USHORTMAX
if (s == null) {
os.writeInt(-1);
} else {
byte array[] = s.getBytes();
os.writeInt(array.length);
os.write(array);
void
writeString(DataOutputStream out, String str) Writes a string to the buffer.
int len = str.length();
if (len >= 65536) {
throw new IllegalArgumentException("String too long.");
out.writeShort(len);
for (int i = 0; i < len; ++i) {
out.writeChar(str.charAt(i));
void
writeString(DataOutputStream out, String text) Writes a string to the given output stream and emits an additional short to transfer if
text is
null.
if (null == text) {
out.writeShort(0);
} else {
out.writeShort(1);
out.writeUTF(text);