public StringPrep(InputStream inputStream) throws IOException {
  BufferedInputStream b=new BufferedInputStream(inputStream,DATA_BUFFER_SIZE);
  StringPrepDataReader reader=new StringPrepDataReader(b);
  indexes=reader.readIndexes(INDEX_TOP);
  byte[] sprepBytes=new byte[indexes[INDEX_TRIE_SIZE]];
  mappingData=new char[indexes[INDEX_MAPPING_DATA_SIZE] / 2];
  reader.read(sprepBytes,mappingData);
  sprepTrieImpl=new StringPrepTrieImpl();
  sprepTrieImpl.sprepTrie=new CharTrie(new ByteArrayInputStream(sprepBytes),sprepTrieImpl);
  formatVersion=reader.getDataFormatVersion();
  doNFKC=((indexes[OPTIONS] & NORMALIZATION_ON) > 0);
  checkBiDi=((indexes[OPTIONS] & CHECK_BIDI_ON) > 0);
  sprepUniVer=getVersionInfo(reader.getUnicodeVersion());
  normCorrVer=getVersionInfo(indexes[NORM_CORRECTNS_LAST_UNI_VERSION]);
  VersionInfo normUniVer=NormalizerImpl.getUnicodeVersion();
  if (normUniVer.compareTo(sprepUniVer) < 0 && normUniVer.compareTo(normCorrVer) < 0 && ((indexes[OPTIONS] & NORMALIZATION_ON) > 0)) {
    throw new IOException("Normalization Correction version not supported");
  }
  b.close();
}

public StringPrep ( InputStream inputStream ) throws IOException { BufferedInputStream b = new BufferedInputStream ( inputStream , DATA_BUFFER_SIZE ) ; StringPrepDataReader reader = new StringPrepDataReader ( b ) ; indexes = reader . readIndexes ( INDEX_TOP ) ; byte [ ] sprepBytes = new byte [ indexes [ INDEX_TRIE_SIZE ] ] ; mappingData = new char [ indexes [ INDEX_MAPPING_DATA_SIZE ] / 2 ] ; reader . read ( sprepBytes , mappingData ) ; sprepTrieImpl = new StringPrepTrieImpl ( ) ; sprepTrieImpl . sprepTrie = new CharTrie ( new ByteArrayInputStream ( sprepBytes ) , sprepTrieImpl ) ; formatVersion = reader . getDataFormatVersion ( ) ; doNFKC = ( ( indexes [ OPTIONS ] & NORMALIZATION_ON ) > 0 ) ; checkBiDi = ( ( indexes [ OPTIONS ] & CHECK_BIDI_ON ) > 0 ) ; sprepUniVer = getVersionInfo ( reader . getUnicodeVersion ( ) ) ; normCorrVer = getVersionInfo ( indexes [ NORM_CORRECTNS_LAST_UNI_VERSION ] ) ; VersionInfo normUniVer = NormalizerImpl . getUnicodeVersion ( ) ; if ( normUniVer . compareTo ( sprepUniVer ) < 0 && normUniVer . compareTo ( normCorrVer ) < 0 && ( ( indexes [ OPTIONS ] & NORMALIZATION_ON ) > 0 ) ) { throw new IOException ( "Normalization Correction version not supported" ) ; } b . close ( ) ; }
creates an stringprep object after reading the input stream . the object does not hold a reference to the input steam , so the stream can be closed after the method returns .
