[sword-svn] r116 - trunk/micro/src/org/crosswire/flashcards
Apache
apache at www.crosswire.org
Sat Mar 10 11:58:57 MST 2007
Author:
Date: 2007-03-10 11:58:56 -0700 (Sat, 10 Mar 2007)
New Revision: 116
Modified:
trunk/micro/src/org/crosswire/flashcards/Properties.java
Log:
Added some code to possibly speed things up and handle \! (why is '!' escaped?) -TAG
Modified: trunk/micro/src/org/crosswire/flashcards/Properties.java
===================================================================
--- trunk/micro/src/org/crosswire/flashcards/Properties.java 2007-03-04 03:10:38 UTC (rev 115)
+++ trunk/micro/src/org/crosswire/flashcards/Properties.java 2007-03-10 18:58:56 UTC (rev 116)
@@ -79,13 +79,14 @@
public static String getInputStreamContents(InputStream is) {
InputStreamReader isr = null;
StringBuffer buffer = null;
+ char buf[] = new char[50];
try {
isr = new InputStreamReader(is, "UTF8");
buffer = new StringBuffer();
- int ch;
- while ( (ch = isr.read()) > -1) {
- buffer.append( (char) ch);
+ int len;
+ while ( (len = isr.read(buf, 0, 50)) > -1) {
+ buffer.append( buf, 0, len);
}
if (isr != null) {
isr.close();
@@ -137,4 +138,21 @@
return in;
}
+ private String processEscapes(String in) {
+ int offset = 0;
+ while (true) {
+ offset = in.indexOf("\\", offset);
+ if ((offset < 0) || (offset > in.length() - 1)) {
+ break;
+ }
+ String val = in.substring(offset+2,offset+6);
+ short valueAsShort = Short.parseShort(val.trim(),16);
+ in = in.substring(0,offset) + in.substring(offset+2);
+ if (in.charAt(offset) == '\\') {
+ offset++;
+ }
+ }
+ return in;
+ }
+
}
More information about the sword-cvs
mailing list