Java Utililty Methods DataOutput Write String

List of utility methods to do DataOutput Write String

  1. HOME
  2. Java
  3. D
  4. DataOutput Write String

Description

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

Method

void writeString(DataOutput dout, String value)
Writes a string.
if (value == null) {
 dout.writeUTF(EMPTY_STRING);
} else {
 dout.writeUTF(value);
void writeString(DataOutput out, String s)
write String
out.writeUTF(s);
void writeString(DataOutput out, String s)
Writes string to output stream accounting for null values.
out.writeBoolean(s == null);
if (s != null)
 out.writeUTF(s);
void writeString(DataOutput out, String s)
write String
if (s != null) {
 byte[] buffer = s.getBytes("UTF-8");
 int len = buffer.length;
 out.writeInt(len);
 out.write(buffer, 0, len);
} else {
 out.writeInt(-1);
void writeString(DataOutput out, String v)
Writes a String value.
if (v == null) {
 out.writeInt(-1);
} else {
 byte[] ba = v.getBytes("UTF-8");
 int l = ba.length;
 out.writeInt(l);
 if (l > 0)
 out.write(ba, 0, l);
...
void writeString(DataOutput output, String s)
write String
byte[] bs = s.getBytes(UTF_8);
writeVInt(output, bs.length);
output.write(bs);
void writeString(final String data, final DataOutput out, final int length)
write String
try {
 byte[] bytes = data.getBytes("UTF-8");
 assert bytes.length <= length;
 out.write(bytes);
 if (bytes.length < length)
 out.write(new byte[length - bytes.length]); 
} catch (IOException ioe) {
 throw new Error(ioe);
...
void writeString(final String string, final DataOutput out)
write String
if (string == null) {
 out.writeBoolean(true);
} else {
 out.writeBoolean(false);
 out.writeUTF(string);
void writeString(String par0Str, DataOutput par1DataOutput)
write String
if (par0Str.length() > 32767) {
 throw new IOException("String too big");
} else {
 par1DataOutput.writeShort(par0Str.length());
 par1DataOutput.writeChars(par0Str);
void writeString(String s, DataOutput output)
Write a String to a DataOutput.
output.writeInt(s.length());
output.writeChars(s);


AltStyle によって変換されたページ (->オリジナル) /