// Path: src/main/java/com/github/davidmoten/rx2/util/ZippedEntry.java
// public final class ZippedEntry {
// 
//     final String name; // entry name
//     final long time; // last modification time
//     // final FileTime mtime; // last modification time, from extra field data
//     // final FileTime atime; // last access time, from extra field data
//     // final FileTime ctime; // creation time, from extra field data
//     final long crc; // crc-32 of entry data
//     final long size; // uncompressed size of entry data
//     final long csize; // compressed size of entry data
//     final int method; // compression method
//     final byte[] extra; // optional extra field data for entry
//     final String comment; // optional comment string for entry
//     private final InputStream is;
// 
//     public ZippedEntry(ZipEntry e, InputStream is) {
//         this.name = e.getName();
//         this.time = e.getTime();
//         // this.mtime = e.getLastModifiedTime();
//         // this.atime = e.getLastAccessTime();
//         // this.ctime = e.getCreationTime();
//         this.crc = e.getCrc();
//         this.size = e.getSize();
//         this.csize = e.getCompressedSize();
//         this.method = e.getMethod();
//         this.extra = e.getExtra();
//         this.comment = e.getComment();
//         this.is = is;
//     }
// 
//     public InputStream getInputStream() {
//         return is;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public long getTime() {
//         return time;
//     }
// 
//     // public FileTime getLastModifiedTime() {
//     // return mtime;
//     // }
// 
//     // public FileTime getLastAccessTime() {
//     // return atime;
//     // }
// 
//     // public FileTime getCreatedtime() {
//     // return ctime;
//     // }
// 
//     public long getCrc() {
//         return crc;
//     }
// 
//     public long getSize() {
//         return size;
//     }
// 
//     public long getCompressedSize() {
//         return csize;
//     }
// 
//     public int getMethod() {
//         return method;
//     }
// 
//     public byte[] getExtra() {
//         return extra;
//     }
// 
//     public String getComment() {
//         return comment;
//     }
// 
// }


import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.concurrent.Callable;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import com.github.davidmoten.rx2.util.ZippedEntry;
import io.reactivex.Emitter;
import io.reactivex.Flowable;
import io.reactivex.Single;
import io.reactivex.functions.BiConsumer;
import io.reactivex.functions.Consumer;
import io.reactivex.functions.Function;
            public Flowable<byte[]> apply(InputStream is) {
                return from(is, size);
            }
        };
        return Flowable.using(resourceFactory, observableFactory, InputStreamCloseHolder.INSTANCE, true);
    }

    private static final class InputStreamCloseHolder {
        static final Consumer<InputStream> INSTANCE = new Consumer<InputStream>() {

            @Override
            public void accept(InputStream is) throws IOException {
                is.close();
            }
        };
    }

    /**
     * Returns a Flowable stream of byte arrays from the given
     * {@link InputStream} of {@code 8192} bytes. The final byte array may be
     * less than {@code 8192} bytes.
     * 
     * @param is
     *            input stream of bytes
     * @return a stream of byte arrays
     */
    public static Flowable<byte[]> from(InputStream is) {
        return from(is, DEFAULT_BUFFER_SIZE);
    }

// Path: src/main/java/com/github/davidmoten/rx2/util/ZippedEntry.java
// public final class ZippedEntry {
// 
//     final String name; // entry name
//     final long time; // last modification time
//     // final FileTime mtime; // last modification time, from extra field data
//     // final FileTime atime; // last access time, from extra field data
//     // final FileTime ctime; // creation time, from extra field data
//     final long crc; // crc-32 of entry data
//     final long size; // uncompressed size of entry data
//     final long csize; // compressed size of entry data
//     final int method; // compression method
//     final byte[] extra; // optional extra field data for entry
//     final String comment; // optional comment string for entry
//     private final InputStream is;
// 
//     public ZippedEntry(ZipEntry e, InputStream is) {
//         this.name = e.getName();
//         this.time = e.getTime();
//         // this.mtime = e.getLastModifiedTime();
//         // this.atime = e.getLastAccessTime();
//         // this.ctime = e.getCreationTime();
//         this.crc = e.getCrc();
//         this.size = e.getSize();
//         this.csize = e.getCompressedSize();
//         this.method = e.getMethod();
//         this.extra = e.getExtra();
//         this.comment = e.getComment();
//         this.is = is;
//     }
// 
//     public InputStream getInputStream() {
//         return is;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public long getTime() {
//         return time;
//     }
// 
//     // public FileTime getLastModifiedTime() {
//     // return mtime;
//     // }
// 
//     // public FileTime getLastAccessTime() {
//     // return atime;
//     // }
// 
//     // public FileTime getCreatedtime() {
//     // return ctime;
//     // }
// 
//     public long getCrc() {
//         return crc;
//     }
// 
//     public long getSize() {
//         return size;
//     }
// 
//     public long getCompressedSize() {
//         return csize;
//     }
// 
//     public int getMethod() {
//         return method;
//     }
// 
//     public byte[] getExtra() {
//         return extra;
//     }
// 
//     public String getComment() {
//         return comment;
//     }
// 
// }


// Path: src/main/java/com/github/davidmoten/rx2/Bytes.java
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.concurrent.Callable;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import com.github.davidmoten.rx2.util.ZippedEntry;
import io.reactivex.Emitter;
import io.reactivex.Flowable;
import io.reactivex.Single;
import io.reactivex.functions.BiConsumer;
import io.reactivex.functions.Consumer;
import io.reactivex.functions.Function;

            public Flowable<byte[]> apply(InputStream is) {
                return from(is, size);
            }
        };
        return Flowable.using(resourceFactory, observableFactory, InputStreamCloseHolder.INSTANCE, true);
    }

    private static final class InputStreamCloseHolder {
        static final Consumer<InputStream> INSTANCE = new Consumer<InputStream>() {

            @Override
            public void accept(InputStream is) throws IOException {
                is.close();
            }
        };
    }

    /**
     * Returns a Flowable stream of byte arrays from the given
     * {@link InputStream} of {@code 8192} bytes. The final byte array may be
     * less than {@code 8192} bytes.
     * 
     * @param is
     *            input stream of bytes
     * @return a stream of byte arrays
     */
    public static Flowable<byte[]> from(InputStream is) {
        return from(is, DEFAULT_BUFFER_SIZE);
    }

    public static Flowable<ZippedEntry> unzip(final File file) {