private String
getFileContent()
throws IOException
{
InputStreamReader reader = null;
try{
byte[] file_bytes = FileUtil.readFileAsByteArray( new File( plistFile ));
// handle UTF-8 encoded BOM EFBBBF
if ( file_bytes.length > 3 &&
file_bytes[0] == (byte)0xEF &&
file_bytes[1] == (byte)0xBB &&
file_bytes[2] == (byte)0xBF ){
found_bom = true;
reader = new InputStreamReader( new ByteArrayInputStream( file_bytes, 3, file_bytes.length - 3 ));
}else{
found_bom = false;
reader = new InputStreamReader( new ByteArrayInputStream( file_bytes ));
}
//max 32KB
int length = 32 * 1024;
char[] buffer = new char[length];
int offset = 0;
int len = 0;
while((len = reader.read(buffer,offset,length-offset)) > 0) {
offset += len;
}
String result = new String(buffer,0,offset);
return result;
} finally {
if(reader != null) {
reader.close();
}
}
//return FileUtil.readFileAsString(new File(plistFile), 64*1024, "UTF-8" );