Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(838)

Unified Diff: main/classes/core/src/com/ibm/icu/text/StringPrep.java

Issue 121870043: ICU ticket #10939: ICU4J optionally read data from .dat and .res (Closed) Base URL: http://source.icu-project.org/repos/icu/icu4j/branches/markus/mapdata/
Patch Set: code review changes r36102 Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: main/classes/core/src/com/ibm/icu/text/StringPrep.java
===================================================================
--- main/classes/core/src/com/ibm/icu/text/StringPrep.java (revision 36076)
+++ main/classes/core/src/com/ibm/icu/text/StringPrep.java (revision 36102)
@@ -14,8 +14,6 @@
import com.ibm.icu.impl.CharTrie;
import com.ibm.icu.impl.ICUBinary;
-import com.ibm.icu.impl.ICUData;
-import com.ibm.icu.impl.ICUResourceBundle;
import com.ibm.icu.impl.StringPrepDataReader;
import com.ibm.icu.impl.UBiDiProps;
import com.ibm.icu.lang.UCharacter;
@@ -272,7 +270,10 @@
*/
public StringPrep(InputStream inputStream) throws IOException{
// TODO: Add a public constructor that takes ByteBuffer directly.
- ByteBuffer bytes = ICUBinary.getByteBufferFromInputStream(inputStream);
+ this(ICUBinary.getByteBufferFromInputStream(inputStream));
+ }
+
+ private StringPrep(ByteBuffer bytes) throws IOException {
StringPrepDataReader reader = new StringPrepDataReader(bytes);
// read the indexes
@@ -328,15 +329,10 @@
}
if (instance == null) {
- InputStream stream = ICUData.getRequiredStream(ICUResourceBundle.ICU_BUNDLE + "/"
- + PROFILE_NAMES[profile] + ".spp");
- if (stream != null) {
+ ByteBuffer bytes = ICUBinary.getRequiredData(PROFILE_NAMES[profile] + ".spp");
+ if (bytes != null) {
try {
- try {
- instance = new StringPrep(stream);
- } finally {
- stream.close();
- }
+ instance = new StringPrep(bytes);
} catch (IOException e) {
throw new ICUUncheckedIOException(e);
}

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b