Search in sources :

Example 1 with UnZipRes

use of com.foobnix.ext.CacheZipUtils.UnZipRes in project LibreraReader by foobnix.

the class FileMetaCore method getEbookMeta.

public EbookMeta getEbookMeta(String path, CacheDir folder, boolean withPDF) {
    EbookMeta ebookMeta = EbookMeta.Empty();
    try {
        if (path.toLowerCase(Locale.US).endsWith(".zip")) {
            CacheZipUtils.cacheLock.lock();
            try {
                UnZipRes res = CacheZipUtils.extracIfNeed(path, folder);
                ebookMeta = getEbookMeta(path, res.unZipPath, res.entryName, withPDF);
                ebookMeta.setUnzipPath(res.unZipPath);
            } finally {
                CacheZipUtils.cacheLock.unlock();
            }
        } else {
            ebookMeta = getEbookMeta(path, path, null, withPDF);
            ebookMeta.setUnzipPath(path);
        }
    } catch (Exception e) {
        LOG.e(e);
    }
    return ebookMeta;
}
Also used : EbookMeta(com.foobnix.ext.EbookMeta) UnZipRes(com.foobnix.ext.CacheZipUtils.UnZipRes) IOException(java.io.IOException)

Aggregations

UnZipRes (com.foobnix.ext.CacheZipUtils.UnZipRes)1 EbookMeta (com.foobnix.ext.EbookMeta)1 IOException (java.io.IOException)1