public String getTextByUTF(String name)
{
String strReturn = "";
int ic;
InputStream in = null;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(baos);
byte[] myData;
byte[] buffer = new byte[1024];
try {
in = getClass().getResourceAsStream(name);
if (in != null) {
while ((ic = in.read(buffer)) > 0) {
dos.write(buffer, 0, ic);
}
myData = baos.toByteArray();
strReturn = new String(myData, "UTF-8");
in.close();
}
dos.close();
baos.close();
} catch (Exception e) {
System.out.println("getTextByUTF Error:" + e.toString());
} finally {
in = null;
dos = null;
baos = null;
}
return strReturn;
}
{
String strReturn = "";
int ic;
InputStream in = null;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(baos);
byte[] myData;
byte[] buffer = new byte[1024];
try {
in = getClass().getResourceAsStream(name);
if (in != null) {
while ((ic = in.read(buffer)) > 0) {
dos.write(buffer, 0, ic);
}
myData = baos.toByteArray();
strReturn = new String(myData, "UTF-8");
in.close();
}
dos.close();
baos.close();
} catch (Exception e) {
System.out.println("getTextByUTF Error:" + e.toString());
} finally {
in = null;
dos = null;
baos = null;
}
return strReturn;
}