public static String utf8Byte2String(byte[] utf8byte, int fromIndex,
int size) {
String s = "";
ByteArrayInputStream strmBytes = null;
DataInputStream strmDataType = null;
;
try {
byte data[] = new byte[size + 2];
data[0] = (byte) (size >> 8);
data[1] = (byte) (size);
System.arraycopy(utf8byte, fromIndex, data, 2, size);
strmBytes = new ByteArrayInputStream(data);
strmDataType = new DataInputStream(strmBytes);
s = strmDataType.readUTF();
} catch (IOException e) {
} catch (Exception e) {
} finally {
if (strmDataType != null) {
try {
strmDataType.close();
} catch (IOException e) {
}
}
if (strmBytes != null) {
try {
strmBytes.close();
} catch (IOException e) {
}
}
}
return s;
}