addons/folo/common/src/main/java/org/commonjava/indy/folo/FoloUtils.java
public static int readZipInputStreamAnd( InputStream inputStream, Consumer<TrackedContent> consumer )
                    throws IOException, ClassNotFoundException
    {
        int count = 0;
        try ( ZipInputStream stream = new ZipInputStream( inputStream ) )
        {
            ZipEntry entry;
            while((entry = stream.getNextEntry())!=null)
            {
                logger.trace( "Read entry: %s, len: %d", entry.getName(), entry.getSize() );
                ByteArrayOutputStream bos = new ByteArrayOutputStream();
                int len;
                byte[] buffer = new byte[1024];
                while ((len = stream.read( buffer)) > 0)
                {
                    bos.write(buffer, 0, len);
                }
                bos.close();

                ObjectInputStream ois = new ObjectInputStream( new ByteArrayInputStream( bos.toByteArray() ));
                TrackedContent record = (TrackedContent) ois.readObject();
                consumer.accept( record );
                count++;
            }
        }
        return count;
    }
public static int readZipInputStreamAnd( InputStream inputStream, Consumer<TrackedContent> consumer )
                    throws IOException, ClassNotFoundException
    {
        int count = 0;
        try ( ZipInputStream stream = new ZipInputStream( inputStream ) )
        {
            ZipEntry entry;
            while((entry = stream.getNextEntry())!=null)
            {
                logger.trace( "Read entry: %s, len: %d", entry.getName(), entry.getSize() );
                ByteArrayOutputStream bos = new ByteArrayOutputStream();
                int len;
                byte[] buffer = new byte[1024];
                while ((len = stream.read( buffer)) > 0)
                {
                    bos.write(buffer, 0, len);
                }
                bos.close();

                ObjectInputStream ois = new ObjectInputStream( new ByteArrayInputStream( bos.toByteArray() ));
                TrackedContent record = (TrackedContent) ois.readObject();
                consumer.accept( record );
                count++;
            }
        }
        return count;
    }
Read records from input stream and execute consumer function.
@param inputStream
@param consumer
@return count of records read from the stream