Changeset 12621
- Timestamp:
- 2006-08-30T17:02:49+12:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/util/Utility.java
r12473 r12621 396 396 } 397 397 398 /////////////////////////////kk added//////////////////////// 399 400 static public StringBuffer readXMLStream(InputStream input_stream) 401 { 402 StringBuffer xml = new StringBuffer(""); 403 404 try { 405 InputStreamReader isr = new InputStreamReader(input_stream, "UTF-8"); 406 BufferedReader buffered_in = new BufferedReader(isr); 407 408 String line = ""; 409 boolean xml_content = false; 410 while((line = buffered_in.readLine()) != null) { 411 if(xml_content) { 412 xml.append(line); 413 xml.append("\n"); 414 } 415 else if(line.trim().startsWith("<?xml")) { 416 xml_content = true; 417 xml.append(line); 418 xml.append("\n"); 419 } 420 } 421 buffered_in = null; 422 } 423 catch (Exception error) { 424 System.err.println("Failed when trying to parse XML stream"); 425 error.printStackTrace(); 426 } 427 428 return xml; 429 } 430 431 /** Builds the cache dir by appending the user path and 'cache'. 398 399 /** Builds the cache dir by appending the user path and 'cache'. 432 400 * @return a File representing the path to the private file cache within the current collection. 433 401 */
Note:
See TracChangeset
for help on using the changeset viewer.