Here you can find the source of writeString(DataOutput dout, String value)
Parameter | Description |
---|---|
dout | - the output to write to. |
value | - the string to write |
Parameter | Description |
---|---|
IOException | - if there is an exception thrown fromDataOutput.writeUTF(). |
public static void writeString(DataOutput dout, String value) throws IOException
//package com.java2s; import java.io.DataOutput; import java.io.IOException; public class Main { /**/*from w w w. j a v a2s .co m*/ * The empty string. */ static final String EMPTY_STRING = ""; /** * Writes a string. If the string is null, EMPTY_STRING is written. Uses * DataOutput.writeUTF() for the write. * * @param dout - the output to write to. * @param value - the string to write * @throws IOException - if there is an exception thrown from * DataOutput.writeUTF(). * @see DataOutput#writeUTF(String) */ public static void writeString(DataOutput dout, String value) throws IOException { if (value == null) { dout.writeUTF(EMPTY_STRING); } else { dout.writeUTF(value); } } }