public static boolean isImage( final InputStream stream )
    {
        try
        {
            // This attempts to read the bytes as an image, returning null if it cannot parse the bytes as an image.
            return null != ImageIO.read( stream );
        }
        catch ( IOException e )
        {
            Log.debug( "An exception occurred while determining if data represents an image.", e );
            return false;
        }
    }
@Test
    public void testIsImageWithFavicon() throws Exception
    {
        // Setup test fixture.
        final InputStream input = getClass().getResourceAsStream( "/favicon.ico" );

        // Execute system under test.
        final boolean result = GraphicsUtils.isImage( input );

        // Verify result.
        assertTrue( result );
    }