public String getXMLfromSd(String savePath, String name) {
if (savePath.trim() == null || savePath.trim().length() == 0
|| name.trim() == null || name.trim().length() == 0)
return null;
String sName = strConvert(name);
File dir = new File(savePath);
File[] files = dir.listFiles();
if (files == null) {
return null;
}
InputStream inputStream = null;
String utfstr = null;
for (int i = 0; i < files.length; i++) {
if (files[i].getName().equals(sName)) {
try {
inputStream = new FileInputStream(savePath + "/"
+ files[i].getName());
ByteArrayOutputStream ba = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int count =0;
while ((count = inputStream.read(buffer))!=-1) {
ba.write(buffer,0,count);
}
ba.close();
String ret=ba.toString();
utfstr=new String(ret.getBytes(),"UTF-8");
break;
} catch (Exception e) {
}
}
}
return utfstr;
}