service/src/main/java/org/torproject/android/service/CustomTorInstaller.java
@Override
    public InputStream openBridgesStream() throws IOException {
        /*
            BridgesList is an overloaded field, which can cause some confusion.
            The list can be:
              1) a filter like obfs4, meek, or snowflake OR
              2) it can be a custom bridge
            For (1), we just pass back all bridges, the filter will occur
              elsewhere in the library.
            For (2) we return the bridge list as a raw stream.
            If length is greater than 9, then we know this is a custom bridge
         */
        String userDefinedBridgeList = Prefs.getBridgesList();
        byte bridgeType = (byte) (userDefinedBridgeList.length() > 9 ? 1 : 0);
        // Terrible hack. Must keep in sync with topl::addBridgesFromResources.
        if (bridgeType == 0) {
            switch (userDefinedBridgeList) {
                case "obfs4":
                    bridgeType = 2;
                    break;
                case "meek":
                    bridgeType = 3;
                    break;
                case "snowflake":
                    bridgeType = 4;
                    break;
            }
        }

        ByteArrayInputStream bridgeTypeStream = new ByteArrayInputStream(new byte[]{bridgeType});
        InputStream bridgeStream = (bridgeType == 1) ? new ByteArrayInputStream((userDefinedBridgeList + "\r\n").getBytes())
                : context.getResources().getAssets().open("common/bridges.txt");
        return new SequenceInputStream(bridgeTypeStream, bridgeStream);
    }
/**
     * Opens bridges list as <code>InputStream</code>. First checks for user defined bridges from the user pref file.
     * If it finds user defined bridges, then the stream will contain only these bridges. Otherwise, it returns
     * a set of predefined bridges.
     */
Opens bridges list as InputStream. First checks for user defined bridges from the user pref file.
If it finds user defined bridges, then the stream will contain only these bridges. Otherwise, it returns
a set of predefined bridges.
Opens bridges list as InputStream . First checks for user defined bridges from the user pref file . If it finds user defined bridges then the stream will contain only these bridges . Otherwise it returns a set of predefined bridges .
@Override
    public InputStream openBridgesStream() throws IOException {
        /*
            BridgesList is an overloaded field, which can cause some confusion.
            The list can be:
              1) a filter like obfs4, meek, or snowflake OR
              2) it can be a custom bridge
            For (1), we just pass back all bridges, the filter will occur
              elsewhere in the library.
            For (2) we return the bridge list as a raw stream.
            If length is greater than 9, then we know this is a custom bridge
         */
        String userDefinedBridgeList = Prefs.getBridgesList();
        byte bridgeType = (byte) (userDefinedBridgeList.length() > 9 ? 1 : 0);
        if (bridgeType == 0) {
            switch (userDefinedBridgeList) {
                case "obfs4":
                    bridgeType = 2;
                    break;
                case "meek":
                    bridgeType = 3;
                    break;
                case "snowflake":
                    bridgeType = 4;
                    break;
            }
        }
        ByteArrayInputStream bridgeTypeStream = new ByteArrayInputStream(new byte[]{bridgeType});
        InputStream bridgeStream = (bridgeType == 1) ? new ByteArrayInputStream((userDefinedBridgeList + "\r\n").getBytes())
                : context.getResources().getAssets().open("common/bridges.txt");
        return new SequenceInputStream(bridgeTypeStream, bridgeStream);
    }
@ Override public InputStream openBridgesStream ( ) throws IOException { /*
            BridgesList is an overloaded field, which can cause some confusion.
            The list can be:
              1) a filter like obfs4, meek, or snowflake OR
              2) it can be a custom bridge
            For (1), we just pass back all bridges, the filter will occur
              elsewhere in the library.
            For (2) we return the bridge list as a raw stream.
            If length is greater than 9, then we know this is a custom bridge
         */ String userDefinedBridgeList = Prefs . getBridgesList ( ) ; byte bridgeType = ( byte ) ( userDefinedBridgeList . length ( ) > 9 ? 1 : 0 ) ; if ( bridgeType == 0 ) { switch ( userDefinedBridgeList ) { case "obfs4" : bridgeType = 2 ; break ; case "meek" : bridgeType = 3 ; break ; case "snowflake" : bridgeType = 4 ; break ; } } ByteArrayInputStream bridgeTypeStream = new ByteArrayInputStream ( new byte [ ] { bridgeType } ) ; InputStream bridgeStream = ( bridgeType == 1 ) ? new ByteArrayInputStream ( ( userDefinedBridgeList + "\r\n" ) . getBytes ( ) ) : context . getResources ( ) . getAssets ( ) . open ( "common/bridges.txt" ) ; return new SequenceInputStream ( bridgeTypeStream , bridgeStream ) ; }
Opens bridges list as <code>InputStream</code>.
Opens bridges list as <code > InputStream< / code > .
// Terrible hack. Must keep in sync with topl::addBridgesFromResources.