public static String[] byteArray2StringArray(byte[] raw) {
ArrayList<String> strs = new ArrayList<String>();
ByteArrayInputStream byteInput = new ByteArrayInputStream(raw);
DataInputStream input = new DataInputStream(byteInput);
try {
while (input.available() > 0) {
int length = input.readInt();
if (length > input.available()) {
return null;
}
byte[] data = new byte[length];
input.read(data);
String str;
try {
str = new String(data, "utf-8");
} catch (java.io.UnsupportedEncodingException e) {
str = new String(data); }
strs.add(str); }
String[] ret = new String[strs.size()];
ret = strs.toArray(ret);
return ret;
} catch (IOException ex) {
return null;
}
}