public OpenLZMAEntry(OpenPath parent, SevenZipEntry entry) { mParent = parent; ze = entry; if (ze.getName().endsWith("/") || ze.isDirectory()) { try { mChildren = list(); } catch (IOException e) { } } }
@Override public String getName() { String name = ze.getName(); if (name.endsWith("/")) name = name.substring(0, name.length() - 1); name = name.substring(name.lastIndexOf("/") + 1); return name; }
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 public Long lastModified() { return ze.getTime(); }
@Override public Boolean isFile() { return !ze.isDirectory(); }
@Override public Boolean isDirectory() { return ze.isDirectory() || ze.getName().endsWith("/"); }
@Override public String getDetails(boolean countHiddenChildren) { String ret = super.getDetails(countHiddenChildren); if (!isDirectory()) ret += " (" + OpenPath.formatSize(ze.getCompressedSize()) + ")"; return ret; }
@Override public OpenPath[] listFiles() throws IOException { return OpenLZMA.this.listFiles(ze.getName()); }
@Override public long length() { return ze.getSize(); }
public String getRelativePath() { return ze.getName(); }