question: private Bitmap readAndDecompressThumbnail ( File file ) { try { if ( file . length ( ) > 0 ) { FileInputStream instream = new FileInputStream ( file ) ; ReadableByteChannel bytechan = Channels . newChannel ( instream ) ; ByteBuffer buff = ByteBuffer . allocateDirect ( ( int ) file . length ( ) ) ; if ( buff != null ) { bytechan . read ( buff ) ; instream . close ( ) ; buff . rewind ( ) ; PDQImage pthumb = DecompressionService . decompressThumbnailImage ( buff ) ; if ( pthumb != null ) { Bitmap bm = ConversionService . convertPDQImageToBitmap ( pthumb , false ) ; pthumb . close ( ) ; return bm ; } } } } catch ( IOException ex ) { ex . printStackTrace ( ) ; } return null ; }
target:  Read and extract a thumbnail-sized image from a file.