如题!!
------解决方案--------------------------------------------------------
for(int i=0;i<String.lenght;i++)
for(int j=0;j<String[i].length;j++){
……//字符串的序列化操作
}
------解决方案--------------------------------------------------------
dos.writeInt(维数);//如String [3][4] arr,维数为2
dos.writeUTF(各维的维擞组成的由间隔符相隔的字符串);//如String [3][4] arr,写成"3,4"
dos.writeUTF(arr[i][j]);//用循环写入数组数据
------解决方案--------------------------------------------------------
private static byte[] serialize(String[][] s) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(baos);
try {
for (int i = 0; i < s.length; i++) {
for (int j = 0; j < s[i].length; j++) {
dos.writeUTF(s[i][j]);
}
}
} catch (IOException ex) {
ex.printStackTrace();
}
return baos.toByteArray();
}