question: public static boolean isAnimated ( InputStream source ) { final byte [ ] buffer = new byte [ FRAME_HEADER_SIZE ] ; try { source . read ( buffer , 0 , FRAME_HEADER_SIZE ) ; int offset = 0 ; int frameHeaders = 0 ; while ( source . read ( buffer , offset , 1 ) > 0 ) { if ( circularBufferMatchesBytePattern ( buffer , offset + 1 , FRAME_HEADER_START ) && ( circularBufferMatchesBytePattern ( buffer , offset + 9 , FRAME_HEADER_END_1 ) || circularBufferMatchesBytePattern ( buffer , offset + 9 , FRAME_HEADER_END_2 ) ) ) { frameHeaders ++ ; if ( frameHeaders > 1 ) { return true ; } } offset = ( offset + 1 ) % buffer . length ; } } catch ( IOException ioe ) { throw new RuntimeException ( ioe ) ; } return false ; }
target:  Checks if source contains more than one frame header in it in order to decide whether a GIF image is animated or not.