将字符串写入DataOutputStream
//package com.nowjava; import java.io.DataOutputStream;/** 来自 时 代 Java - nowjava.com**/ import java.io.IOException; public class Main { public static void writeString(DataOutputStream out, String string) throws IOException { out.writeInt(string.length()); out.writeChars(string); } public static void writeInt(DataOutputStream out, int i) throws IOException { out.writeInt(i); } }