日期:2014-05-20 浏览次数:20980 次
InputStream is = getClass().getResourceAsStream("/BookMark/" + this.MARK_PATH);
if (is != null) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int ch = 0;
try {
while ((ch = is.read()) != -1) {
baos.write(ch);
}
} catch (IOException e) {
e.printStackTrace();
}
byte[] text = baos.toByteArray();
try {
baos.close();
} catch (IOException e) {
e.printStackTrace();
}
try {
str = new String(text, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
public int getBookMark(String name) {
int st = 0;
int ed = 0;
String[] array = null;
System.out.println(name);
st = bookMarks.indexOf(name);
if(st == -1)
return -1;
ed = bookMarks.indexOf(";", st);
array = Config.split(bookMarks.substring(st, ed), "=");
return Integer.parseInt(array[1]);
}