private InputStream openInputStream ( @ NonNull final Uri stream , final String mimeType , final int mbrSize , final int types ) throws IOException { final InputStream is = getContentResolver ( ) . openInputStream ( stream ) ; if ( MIME_TYPE_ZIP . equals ( mimeType ) ) return new ArchiveInputStream ( is , mbrSize , types ) ; final String [ ] projection = { MediaStore . Images . Media . DISPLAY_NAME } ; final Cursor cursor = getContentResolver ( ) . query ( stream , projection , null , null , null ) ; try { if ( cursor . moveToNext ( ) ) { final String fileName = cursor . getString ( 0 /* DISPLAY_NAME*/ ) ; if ( fileName . toLowerCase ( Locale . US ) . endsWith ( "hex" ) ) return new HexInputStream ( is , mbrSize ) ; } } finally { cursor . close ( ) ; } return is ; }
Opens the binary input stream . A Uri to the stream is given .