public OpenLZMA(OpenFile file) { mFile = file; try { mRAF = new MyRandomAccessFile(file.getPath(), "r"); mLZMA = new Handler(); mLZMA.Open(mRAF); // Logger.LogInfo("LZMA file " + LZMAFile + " has " + length() + // " entries"); } catch (IOException e) { Logger.LogError("Couldn't open LZMA file (" + file + ")"); } }
public List<OpenLZMAEntry> getAllEntries() throws IOException { if (mEntries != null) return mEntries; mEntries = new ArrayList<OpenLZMAEntry>(); for (int i = 0; i < mLZMA.size(); i++) { SevenZipEntry ze = mLZMA.getEntry(i); if (ze.isDirectory()) continue; String parent = ze.getName(); if (parent.indexOf("/") > 0 && parent.indexOf("/") < parent.length() - 1) parent = parent.substring(0, parent.lastIndexOf("/") + 1); else parent = ""; OpenPath vp = findVirtualPath(parent); OpenLZMAEntry entry = new OpenLZMAEntry(vp, ze); mEntries.add(entry); addFamilyEntry(parent, entry); } Set<String> keys = mFamily.keySet(); for (String path : keys.toArray(new String[keys.size()])) { if (path.equals("")) continue; addFamilyPath(path); } return mEntries; }
@Override protected void finalize() throws Throwable { super.finalize(); if (mLZMA != null) try { mLZMA.close(); } catch (Exception e) { } if (mRAF != null) try { mRAF.close(); } catch (Exception e) { } }