Revision 4677
Added by daigle about 16 years ago
src/edu/ucsb/nceas/metacat/DocumentImpl.java | ||
---|---|---|
63 | 63 |
import edu.ucsb.nceas.metacat.util.SystemUtil; |
64 | 64 |
import edu.ucsb.nceas.utilities.FileUtil; |
65 | 65 |
import edu.ucsb.nceas.utilities.PropertyNotFoundException; |
66 |
import edu.ucsb.nceas.utilities.StringUtil; |
|
66 | 67 |
|
67 | 68 |
import org.apache.log4j.Logger; |
68 | 69 |
import org.xml.sax.ContentHandler; |
... | ... | |
1525 | 1526 |
return changedString; |
1526 | 1527 |
} |
1527 | 1528 |
|
1528 |
private static String readerToString(Reader reader) throws IOException { |
|
1529 |
String xmlString = ""; |
|
1530 |
int tmp = reader.read(); |
|
1531 |
while (tmp != -1) { |
|
1532 |
xmlString += (char) tmp; |
|
1533 |
tmp = reader.read(); |
|
1534 |
} |
|
1535 |
|
|
1536 |
reader.reset(); |
|
1537 |
return xmlString; |
|
1538 |
} |
|
1529 |
// private static String readerToString(Reader reader) throws IOException {
|
|
1530 |
// String xmlString = "";
|
|
1531 |
// int tmp = reader.read();
|
|
1532 |
// while (tmp != -1) {
|
|
1533 |
// xmlString += (char) tmp;
|
|
1534 |
// tmp = reader.read();
|
|
1535 |
// }
|
|
1536 |
// |
|
1537 |
// reader.reset();
|
|
1538 |
// return xmlString;
|
|
1539 |
// }
|
|
1539 | 1540 |
|
1540 | 1541 |
/** |
1541 | 1542 |
* Build the index records for this document. For each node, all absolute |
... | ... | |
2509 | 2510 |
// NEW - WHEN CLIENT ALWAYS PROVIDE ACCESSION NUMBER INCLUDING REV IN IT |
2510 | 2511 |
|
2511 | 2512 |
// Get the xml as a string so we can write to file later |
2512 |
String xmlString = readerToString(xml); |
|
2513 |
String xmlString = StringUtil.readerToString(xml);
|
|
2513 | 2514 |
|
2514 | 2515 |
logMetacat.info("conn usage count before writting: " |
2515 | 2516 |
+ conn.getUsageCount()); |
... | ... | |
2760 | 2761 |
boolean timedReplication, String createDate, String updateDate) throws Exception |
2761 | 2762 |
{ |
2762 | 2763 |
// Get the xml as a string so we can write to file later |
2763 |
String xmlString = readerToString(xml); |
|
2764 |
String xmlString = StringUtil.readerToString(xml);
|
|
2764 | 2765 |
|
2765 | 2766 |
long rootId; |
2766 | 2767 |
String docType = null; |
Also available in: Unified diff
move readerToString function to StringUtil class in utilities module.