List of utility methods to do DataOutputStream Write String
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 os, String str) Writes string into DataOutputStream. if (str != null) { os.writeInt(str.length()); os.writeChars(str); } else { os.writeInt(0); |
void | writeString(DataOutputStream out, String s) write String boolean isNull = s == null; out.writeBoolean(isNull); if (!isNull) { out.writeUTF(s); |
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 str) write String byte[] b = str.getBytes();
out.writeInt(b.length);
out.write(b);
|
void | writeString(DataOutputStream out, String str) Writes a string to a DataInputStream. out.writeShort(str.length()); for (char letter : str.toCharArray()) { out.writeChar(letter); |
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); |
void | writeString(DataOutputStream out, String theString) Write a string. if (theString == null) { out.writeInt(-1); } else { int len = theString.length(); out.writeInt(len); writeCharsOfString(out, theString); |
void | writeString(DataOutputStream out, String val) write String out.writeUTF(val);
|