src/main/java/org/vafer/jdependency/utils/StreamUtils.java
public static Stream<JarEntry> asStream( final JarInputStream pInputStream ) {
        return StreamSupport.stream(Spliterators.spliteratorUnknownSize(
            new Iterator<JarEntry>() {

                JarEntry entry = null;

                public boolean hasNext() {
                    try {
                        if (entry == null) {
                            entry = pInputStream.getNextJarEntry();
                        }
                        return entry != null;
                    } catch(IOException e) {
                        throw new RuntimeException(e);
                    }
                }

                public JarEntry next() {
                    try {
                        JarEntry result = entry != null
                          ? entry
                          : pInputStream.getNextJarEntry();
                        entry = null;
                        return result;
                    } catch(IOException e) {
                        throw new RuntimeException(e);
                    }
                }

            }, Spliterator.IMMUTABLE), false);
    }
public static Stream<JarEntry> asStream( final JarInputStream pInputStream ) {
        return StreamSupport.stream(Spliterators.spliteratorUnknownSize(
            new Iterator<JarEntry>() {

                JarEntry entry = null;

                public boolean hasNext() {
                    try {
                        if (entry == null) {
                            entry = pInputStream.getNextJarEntry();
                        }
                        return entry != null;
                    } catch(IOException e) {
                        throw new RuntimeException(e);
                    }
                }

                public JarEntry next() {
                    try {
                        JarEntry result = entry != null
                          ? entry
                          : pInputStream.getNextJarEntry();
                        entry = null;
                        return result;
                    } catch(IOException e) {
                        throw new RuntimeException(e);
                    }
                }

            }, Spliterator.IMMUTABLE), false);
    }
public static Stream < JarEntry > asStream ( final JarInputStream pInputStream ) { return StreamSupport . stream ( Spliterators . spliteratorUnknownSize ( new Iterator < JarEntry > ( ) { JarEntry entry = null ; public boolean hasNext ( ) { try { if ( entry == null ) { entry = pInputStream . getNextJarEntry ( ) ; } return entry != null ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } public JarEntry next ( ) { try { JarEntry result = entry != null ? entry : pInputStream . getNextJarEntry ( ) ; entry = null ; return result ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } } , Spliterator . IMMUTABLE ) , false ) ; }
}
}