@ Nonnull public static Homoglyph build ( @ Nonnull @ WillClose final Reader aReader ) throws IOException { ValueEnforcer . notNull ( aReader , "reader" ) ; try ( final NonBlockingBufferedReader aBR = new NonBlockingBufferedReader ( aReader ) ) { final ICommonsList < IntSet > aList = new CommonsArrayList <> ( ) ; String sLine ; while ( ( sLine = aBR . readLine ( ) ) != null ) { sLine = sLine . trim ( ) ; if ( sLine . startsWith ( "#" ) || sLine . length ( ) == 0 ) continue ; final IntSet aSet = new IntSet ( sLine . length ( ) / 3 ) ; for ( final String sCharCode : StringHelper . getExploded ( ' ' , sLine ) ) { final int nVal = StringParser . parseInt ( sCharCode , 16 , - 1 ) ; if ( nVal >= 0 ) aSet . add ( nVal ) ; } aList . add ( aSet ) ; } return new Homoglyph ( aList ) ; } }
Consumes the supplied Reader and uses it to construct a populated Homoglyph object .